Converting a 3D matrix to several 2D matrices

1 回表示 (過去 30 日間)
mohammad
mohammad 2022 年 12 月 15 日
編集済み: Voss 2022 年 12 月 15 日
If I define 's1' as follows( i dont know Is it correct to define 's ' as a three-dimensional matrix?)
max_iteration=5;
a=zeros(10,48);
b=zeros(10,48);
for k=1:max_iteration
for i=1:10
s(k,i,:)=(a(i,:)-b(i,:);
end
Now, I want to find out "s" value , for example in iteration 4 . I mean how i can findout in intration4 , value s_new(:,:) which is 2d matrix with size 10*48 ?
itr1 : s1
itr2 : s2
itr3 : s3
itr4 : s4
itr5 : s5
which s1,s2,s3,s4,s5 should be 10*48

採用された回答

Voss
Voss 2022 年 12 月 15 日
編集済み: Voss 2022 年 12 月 15 日
max_iteration=5;
a=zeros(10,48);
b=zeros(10,48);
s = zeros(10,48,max_iteration);
for k=1:max_iteration
% presumably a and/or b change on each iteration
s(:,:,k) = a-b;
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by