フィルターのクリア

Save the data of each iteration of a for loop followed by a convergence criteria

1 回表示 (過去 30 日間)
RAJ
RAJ 2019 年 11 月 6 日
編集済み: RAJ 2019 年 11 月 6 日
Dear all
I have a set of for-loop iterations from j=1 to j=120 which is running an algorithm inside it. I want to save the data of a particular output variable say, YMF{i} for each iteration and as a convergence criteria of the simulation I want to check that if the values of ((YMF(j-1) - YMF(j))/YMF(j-1)) <= 0.02.
I dont know how to introduce iteration number i.e j along with row number i.e i to perform the above task.
N.B: YMF is a variable having 500 rows(i) that has been stored in cell arrays for each iteration.
Please help. I am new to MATLAB. Any help is highly appreciated. I would be grateful to provide any other data if you might need to address the issue. Thanks in advance.
store= zeros(500,120) % preallocate a matrix of 500 rows and 120 columns(iteration number)
while ((store{i,(j-1)} - store{i,(j)})/store{i,(j-1)}) <= 0.02 | (j<120)
j=j+1;
store(:,j)= [YMF{i}]
end

回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by