cs=ebsd ('Magnesium').CS
%first calculate the odf to generate continuous data.
odf=calcODF(ebsd('Magnesium').orientations,'halfwidth',5*degree);
%select the maximum from the odf, and load the 3d vector into the
% variable 'modes', and skip return of 'values' by using ~ in that place
[modes, ~] = calcModes(odf,1);
%transform the mode output into the appropriate crystallographic vector
dir = modes(1).*Miller(0,0,0,1,cs);