MATLAB: How can the output of a order character string stored in a variable

no tags

i have a structure variable contain several field, i wish insert once of fields that dispaly of this field is Character to form string in another variable. for example : A(1).name='walter'; A(2).name='xosro'; A(1).rank=1; A(2).rank=10; i wish have : names=cell(2,1); names=A(1:2).name; that

Best Answer

Hi xosro,
I'm not sure if this is what you want, but
names = {A(1:2).name}
collects the names into a cell array (or {A.names} if you want all).
Titus