下面写法是会报错的:
s(1)=struct('name','Yang','friends',{'Tao','Li','Chow'});
s(2)=struct('name','Jakie','friends',{'Tom','John'});
disp(s);
但是下面写法却可以:
s(1).name='Yang';
s(1).friends={'Tao','Li','Chow'};
s(2).name='Jakie';
s(2).friends={'Tom','John'};
disp(s);
目前不明白是为什么。