Save each loop values, without overwriting

 採用された回答

KALYAN ACHARJYA
KALYAN ACHARJYA 2019 年 1 月 25 日
編集済み: KALYAN ACHARJYA 2019 年 1 月 25 日

0 投票

for i=1:10
a(i)=..... %using array
end
Here value will not replace, values save as a(1), a(2).. etc

3 件のコメント

Nicholas Appiah
Nicholas Appiah 2021 年 9 月 17 日
How do I do this if I want a list of files but not an array of values?
KALYAN ACHARJYA
KALYAN ACHARJYA 2021 年 9 月 18 日
Chaudhary P Patel
Chaudhary P Patel 2022 年 6 月 7 日
% I am facing the that Utt for n=5 replacing the others, so I am unable to call the previous value of Utt for n=1,2,3, and 4 .
for i=1:1:10
for n=1:1:5
if n==1
Utt(:,i+1)=([zeros(3,1); utdelt(1:3,i+1)]); % utdelt (15X10)
else
d1=1+(n-2)*3;
d2=6+(n-2)*3;
Utt(:,i+1)=utdelt(d1:d2,i+1);
end
end
end
% end of the loop Utt is only saved for n=5, how can i save all the value
% of Utt for n=1,2,3,4 also.

サインインしてコメントする。

その他の回答 (1 件)

madhan ravi
madhan ravi 2019 年 1 月 25 日

0 投票

https://www.mathworks.com/help/matlab/matlab_prog/preallocating-arrays.html - essential for a loop and see how the variables are indexed using loop iterator.

2 件のコメント

KALYAN ACHARJYA
KALYAN ACHARJYA 2019 年 1 月 25 日
@madhan ravi Sir
Congratulations! MVP
madhan ravi
madhan ravi 2019 年 1 月 25 日
Thank you!

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeStartup and Shutdown についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by