how to convert a 3D array into a n 2D arrays

2 ビュー (過去 30 日間)
Hugo
Hugo 2022 年 2 月 23 日
回答済み: Kevin Holly 2022 年 2 月 23 日
Hi,
I have a 3D array, called A, that is 20*1000*30.
How can I convert the matrix A into 20 2D arrays, with size 1000*30, in which each array represents (i,:,:), where i is the ID of the array.
Best regards,

採用された回答

Kevin Holly
Kevin Holly 2022 年 2 月 23 日
A=rand(20,1000,30);
for i = 1:20
B{i} = squeeze(A(i,:,:));
end
B
B = 1×20 cell array
{1000×30 double} {1000×30 double} {1000×30 double} {1000×30 double} {1000×30 double} {1000×30 double} {1000×30 double} {1000×30 double} {1000×30 double} {1000×30 double} {1000×30 double} {1000×30 double} {1000×30 double} {1000×30 double} {1000×30 double} {1000×30 double} {1000×30 double} {1000×30 double} {1000×30 double} {1000×30 double}

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

タグ

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by