Updating grain IDs in MTEX 4.0

145 views
Skip to first unread message

Andrew Cross

unread,
Oct 23, 2014, 5:23:33 AM10/23/14
to mtex...@googlegroups.com
Hi,

I am using the following command to calculate grains and grain IDs in MTEX 4.0

[grains,ebsd.grainId,ebsd.mis2mean] = calcGrains(ebsd,'angle',10*degree);

Which calculates 2605 grains for me. I then remove some small grains:

grains = grains(grains.grainSize > 4)

And now I have 1535 grains, which I would like to use for misorientation analysis:

ind = ebsd.mis2mean.angle > 20*degree;
grainIds 
= ebsd(ind).grainId;
grainIds = unique(grainIds);

Now the grainIds go up to 2605, so the following command will not work, because there are only 1535 grains:

distortedgrains = grains(grainIds)


Is there a way to update the property ebsd.grainIds after removing grains?

Thank you

Ralf Hielscher

unread,
Oct 23, 2014, 5:44:10 AM10/23/14
to mtex...@googlegroups.com
Hi Andrew,

the grains have a field called id which does not change after taking subsets and what is exactly what ebsd.grainId refers to.  Thus in your case after

[grains,ebsd.grainId,ebsd.mis2mean] = calcGrains(ebsd,'angle',10*degree);

grains
= grains(grains.grainSize > 4)


ind
= ebsd.mis2mean.angle > 20*degree;
grainIds
= ebsd(ind).grainId;
grainIds
= unique(grainIds);

You have to check whether grain.id is in the list grainIds

distortedgrains = grains(ismember(grains.id,grainIds))

I hope this helps,

Ralf.

Reply all
Reply to author
Forward
0 new messages