How to save a variable within a for loop?
古いコメントを表示
For a certain lon a lat:
days=13;
for indice=1:days
c1=max(max(u0(lon_useful,lat_useful,1,indice)));
save('fev_fim_2019.mat','c1');
end
How can I save c1 without it being severe on the top each time i run the code?
I've tried :
save('fev_fim_2019.mat','c1(indice)');
But give me the following error:
Error using save
'c1(indice)' is not a valid variable name.
2 件のコメント
Mathieu NOE
2021 年 4 月 28 日
hello
what do you mean by "severe" ?? I don't understand the sentence :
How can I save c1 without it being severe on the top each time i run the code?
回答 (1 件)
Jan
2021 年 4 月 28 日
Maybe you can omit the loop:
days = 13;
c = max(u0(lon_useful, lat_useful, 1, 1:days), [], 4);
save('fev_fim_2019.mat', 'c');
カテゴリ
ヘルプ センター および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!