How to save more than the last matrix in a for cycle

1 回表示 (過去 30 日間)
Nicolò Bortone
Nicolò Bortone 2019 年 11 月 22 日
回答済み: Nicolò Bortone 2019 年 11 月 25 日
Good morning,
i am having some problem with this script:
for j=1:1:125001
for N=1:1:36
e_mat=[unitstressEpsX(j,1:6);unitstressEpsY(j,1:6);unitstressEpsZ(j,1:6);...
unitstressEpsXY(j,1:6);unitstressEpsXZ(j,1:6);unitstressEpsYZ(j,1:6);];
Sigma_elem=EPSM(N,1:6).*e_mat/0.6;
end
end
I wish i could have a Sigma_elem made of 125001x6. UnitstressEpsX is a 125001x6. The problem is that i have only a 6x6 matrix for Sigma_elem. How can i save all the matrix 6x6 that for cycle gives me instead of the last one only?
Thank you very much

回答 (2 件)

Bob Thompson
Bob Thompson 2019 年 11 月 22 日
You need to index Sigma_elem.
Sigma_elem(:,:,i,N)=EPSM(N,1:6).*e_mat/0.6; % Or something similar

Nicolò Bortone
Nicolò Bortone 2019 年 11 月 25 日
Thank you very much. This was really helpful!

カテゴリ

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