Save the data of each iteration of a for loop followed by a convergence criteria
조회 수: 2 (최근 30일)
이전 댓글 표시
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
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Performance and Memory에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!