[英]Find the minimum distance to a number from the elements of an array in MATLAB
在MATLAB的數組A中,找到一個距離最小的距離(例如說2.5
)的有效方法是什么?
我的問題是,當我使用功能min
min(abs(A - 2.5))
我得到一個答案,例如0.0053我不知道減法后給出最小差的數字的索引是多少。
我嘗試再次添加數字,所以我得到2.5053,當我嘗試這樣做時
find(2.5053)
我得到:
Empty matrix: 1-by-0
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.