Save the data of each iteration of a for loop followed by a convergence criteria
    2 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
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 Commenti
Risposte (0)
Vedere anche
Categorie
				Scopri di più su Performance and Memory in Help Center e File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
