我有一行,在octave / matlab
中的数组中有数百列example of a row:
540 6.28319 0 538.3 6.26573 0
我希望它看起来像这样。每隔3列将数据移动到下一行。
540 6.28319 0
538.3 6.26573 0
我确实尝试过:
tmp = [540 6.28319 0 538.3 6.26573 0];
a = reshape(tmp, [], 3); but that gives me
540 0 6.26573
6.28319 538.3 0
我想要
540 6.28319 0
538.3 6.26573 0
我该怎么做呢? 感谢
答案 0 :(得分:5)
tmp = [540 6.28319 0 538.3 6.26573 0]
a = reshape(tmp, 3, [])'
给出:
a =
540.0000 6.2832 0
538.3000 6.2657 0