Rounding numbers using a condition?
Mostra commenti meno recenti
I have an array of numbers ranging from 95 to 116. I would like to have the numbers closest to 99 in value be 99, the numbers closest to 104 in value be 104 and the number closest to 115 in value be 115. How could code this? Thanks for the help.
Risposta accettata
Più risposte (1)
Steven Lord
il 28 Apr 2016
1 voto
Use interp1 with the 'nearest' method.
Categorie
Scopri di più su Matrix Indexing in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!