Comparing updated array from two consecutive iterations
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi, I need to create a while loop for a for loop which iterates until the difference between the array c of the current iteration and the array c of the previous iteration is small. Any suggestions on how I could save the updated array for each iteration and then compare the 2 consecutive iterations?
0 commentaires
Réponse acceptée
Plus de réponses (1)
Roger Stafford
le 17 Avr 2017
Use a while loop that is sure to make at least two trips through.
old = all NaNs so as to surely fail 1st test
b = false;
while ~b
new = ...
b = old and new difference is sufficiently small
old = new;
end
0 commentaires
Voir également
Catégories
En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!