Rounding numbers using a condition?
Ältere Kommentare anzeigen
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.
Akzeptierte Antwort
Weitere Antworten (1)
Steven Lord
am 28 Apr. 2016
1 Stimme
Use interp1 with the 'nearest' method.
Kategorien
Mehr zu Matrix Indexing finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!