Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Matlabで、2つの変数を順番に値を取る1つの変数に結合するにはどうすればよいですか?つまり、最初から1つ、次に2つ目から、次に最初から1つを取得します...
たとえば、参加するには
1 2 3
と
4 5 6
の中へ
1 4 2 5 3 6
非常に基本的な質問かもしれませんが、Matlabは初めてです。前もって感謝します!
それらを行ベクトルとして垂直に連結してから、結果を列に変換し直します。
reshape([x(:), y(:)]', [], 1)
x = (1:3)'; y = (4:6)'; reshape([x(:), y(:)]', [], 1)
これにより、次のようになります。
ans = 1 4 2 5 3 6