arrays - 如何将结构数组切片成行,而不是列?

标签 arrays matlab structure

考虑以下因素。

a(1).x = [1 2 3];
a(2).x = [4 5 6];

[a.x] 将为您提供 [1 2 3 4 5 6]

如何轻松得到[1 2 3; 4 5 6]。 IE。例如,不使用 reshape 。

附言语法 [a.x;] 会很酷。

最佳答案

你可以使用 vertcat 来做到这一点:

vertcat(a.x)

ans =

 1     2     3
 4     5     6

关于arrays - 如何将结构数组切片成行,而不是列?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15576509/

相关文章:

python - 从 numpy 数组中删除 "nan"值

javascript - 将对象数组转换为 Google Charts 数组

matlab - 分类:处理弃权/拒绝类别

python - 从Python脚本调用Matlab函数: "not enough values to unpack" ValueError

c - 数组排序

c++ - 维护一个有序的(通过参数,int)集合

arrays - Scala 中的 apply() 函数出现编译错误?

java - 将数组值设置为静态

image - 颜色图显示灰度图像之间的差异

c++ - 结构成员的文件输入示例?