How to break loop when successive values are too close
Mostra commenti meno recenti
I want to exit from the loop when successive matrix value is too close.For example:. For n=1:100 If f(n+1)==f(n) Break; end; end; It also good if I compare upto 4 digits or some tolerance value. Is there any matlab function is there for it?
Risposta accettata
Più risposte (1)
Sulaymon Eshkabilov
il 5 Giu 2021
Modificato: Sulaymon Eshkabilov
il 5 Giu 2021
0 voti
In this case, it can be solved using round(D, n) to set up the tolerance value. Where n is correct decimal digits.
Categorie
Scopri di più su Loops and Conditional Statements in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!