Lookup Table the floor value
显示 更早的评论
I´m a new user of Matlab and I´m trying to get the y floor value of a table. I´ve looking for it and the interpn1 command only let you to get the nearest value not the floor.
An example is for the table:
1 10
10 30
If I ask for the value of 9, I need to get 10 (if I use interpn1 nearest I get 30).
Thanks in advance
采纳的回答
更多回答(4 个)
the cyclist
2011-4-12
If A is your array, I think you want something like:
y_floor = min(A(A>9))
Andrei Bobrov
2011-4-12
added variant
A = randi(120,5,5)
n = 9
[~,I] = min(abs(A(:)-n));
A(I)
Walter Roberson
2011-4-12
0 个投票
Use the two output form of histc() to get the bin numbers, and use the bin numbers to index the y table.
类别
在 帮助中心 和 File Exchange 中查找有关 Tables 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!