Hi guys I have a 3d matrix with values A(1:3, 1:3, 1:12) and I want to transform them into 2D matrix B where B(1,1)=A(1,1,1) B(2,1)=A(1,2,1) B(3,1)=A(1,3,1) B(4,1)=A(1,1,2)..... B(36,1)=A(1,3,12)
and I would like to to the same for 3 columns. I tried to do it with 'for' loop but it doesn't work. I'd be glad for any help ;)
for i=1:3
for l=1:12
for k=1:3
B(:,)=A(1,k,l);
end
end
end

回答 (1 件)

Star Strider
Star Strider 2018 年 5 月 3 日

0 投票

I would use the reshape function:
B = reshape(A, [], 1);
You may have to experiment with it to get the result you want.

カテゴリ

ヘルプ センター および File Exchange で Multidimensional Arrays についてさらに検索

質問済み:

2018 年 5 月 3 日

回答済み:

2018 年 5 月 3 日

Community Treasure Hunt

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

Start Hunting!

Translated by