1
是否有一个1×3结构阵列和3×1结构阵列之间的差异?从我所看到的情况来看,似乎没有,但我不完全确定。结构数组维度
是否有一个1×3结构阵列和3×1结构阵列之间的差异?从我所看到的情况来看,似乎没有,但我不完全确定。结构数组维度
是的,有区别,但它只会在一些时间。这也适用于数值数组,所以我将在下面的例子中使用它们来简化。
对于linear indexing无论是对于行还是列向量都无关紧要。
a = [4, 5, 6];
b = a.';
a(1) == b(1)
a(2) == b(2)
a(3) == b(3)
如果您使用两个维度来索引它,但这很重要。
% Will work
a(1, 3)
% Won't work
a(3, 1)
% Will Work
b(3, 1)
% Won't work
b(1, 3)
最重要的是当你将它与另一个struct
结合起来。尺寸必须允许连接。
a = [1 2 3];
b = a.';
% Cannot horizontally concatenate something with 1 row with something with 3 rows
[a, b]
% You need to make sure they both have the same # of rows
[a, a] % or [a, b.']