Rounding numbers using a condition?
이전 댓글 표시
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.
채택된 답변
추가 답변 (1개)
Steven Lord
2016년 4월 28일
1 개 추천
Use interp1 with the 'nearest' method.
카테고리
도움말 센터 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!