Set field members in a structure. oo(1,1).f0= 1; oo = setfield(oo,{1,2},'fd',{3},'b', 6); oo(1,2).fd(3).b == 6 ans = 1 Note that this function could be written i1= {1,2}; i2= 'fd'; i3= {3}; i4= 'b'; oo( i1{:} ).( i2 )( i3{:} ).( i4 ) == 6; See also: getfield rmfield isfield isstruct fieldnames struct
Set field members in a structure.
oo(1,1).f0= 1; oo = setfield(oo,{1,2},'fd',{3},'b', 6); oo(1,2).fd(3).b == 6 ans = 1
Note that this function could be written
i1= {1,2}; i2= 'fd'; i3= {3}; i4= 'b'; oo( i1{:} ).( i2 )( i3{:} ).( i4 ) == 6;