フィルターのクリア

How do I create such matrix ? (please look at the thread for further details)

1 回表示 (過去 30 日間)
Derick Wong
Derick Wong 2013 年 12 月 20 日
編集済み: Azzi Abdelmalek 2013 年 12 月 20 日
Hi,
Let say I have a matrix of [X1 X2 ... Xm], [Y1 Y2 ... Ym] and [Z1 Z2 ... Zm].
All mentioned matrix have m column and n row each, how do I make it in such a way that it becomes [X1 Y1 Z1 X2 Y2 Z2 ... Xm Ym Zm] that gives 3m columns and n rows matrix?

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 12 月 20 日
編集済み: Azzi Abdelmalek 2013 年 12 月 20 日
A=[1 2 3;4 5 6]
B=[11 22 33;44 55 66]
C=[111 222 333 ;444 555 666]
[n m]=size(A);
p=3 % number of variables;
A=A';
B=B';
C=C';
out=reshape([A(:) B(:) C(:)]',m*p,[])'

その他の回答 (1 件)

Jos (10584)
Jos (10584) 2013 年 12 月 20 日
help cat
help vertcat
help transpose
help reshape
After reading about those functions you should be able to do it yourself and learned a lot along the way. Just try (and fail and try and fail and try …) and succeed!

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by