wupeng0618
2008-07-14, 18:40
各位大哥,我刚学MATLAB,有些地方不懂!
a=struct('x',[1 2 ; 6 3],'str',{{'wupeng','huaqiao';[12 3 6;23 6 5],'yucong'}})与
a=struct('x',[1 2 ; 6 3],'str',{'wupeng','huaqiao';[12 3 6;23 6 5],'yucong'})的区别!!!
为什么输出结果不同?
各位大哥,我刚学MATLAB,有些地方不懂!
a=struct('x',[1 2 ; 6 3],'str',{{'wupeng','huaqiao';[12 3 6;23 6 5],'yucong'}})与
a=struct('x',[1 2 ; 6 3],'str',{'wupeng','hu...
第一句:
a=struct('x',[1 2 ; 6 3],'str',{{'wupeng','huaqiao';[12 3 6;23 6 5],'yucong'}})
该语句创建一个1x1结构体数组a,包括域 x 和 str。
其中,x域中仅有一个2x2 double矩阵;在str域中,为1个2x2 的cell,两重{{ }}就是将
'wupeng','huaqiao';[12 3 6;23 6 5],'yucong' 宣明为一个 2x2 cell的内容。
第二句:
a=struct('x',[1 2 ; 6 3],'str',{'wupeng','huaqiao';[12 3 6;23 6 5],'yucong'})
该语句创建了一个2x2结构体数组,同样包括域 x 和 str。
其中,x域中为2x2 double矩阵;而在str域中,为2x2的结构体,也就是说,这个构建
结构体的语句,单重括号表示其括起来的是'str'域内的一个结构体数组。
vBulletin® v3.8.3,版权所有 ©2000-2025,Jelsoft Enterprises Ltd.