How can I find index and matched value in vector
7 views (last 30 days)
Show older comments
Vector = [ -0.0000 -0.0000 0.0000 0.0000 0.0000 -0.0000 0.0000 0.0000 -0.0000 0.0000 -0.0000 0.0000 -0.0000 0.0000 -0.0000 -0.0000 0.0000 -0.0000 0.0000 0.0000 0.0000 -0.0000 -0.0000 -0.0000 -0.0000 0.0000 -0.0000 0.0000 -0.0000 -0.0000 0.0000 -0.3315];
[row,col,v] = find(abs(Vector)>=0.0001)
row =
32
col =
1
v =
1
Index(row) is 32 and v = 1. But true value is -0.3315.
How can I find index and matched value in vector?
0 Comments
Accepted Answer
Stephen23
on 21 Jan 2016
Edited: Stephen23
on 21 Jan 2016
>> Vector(row,col)
ans = -0.33150
Or if you do not need the index then you can use logical indexing:
>> Vector(abs(Vector)>=0.0001)
ans = -0.33150
2 Comments
More Answers (0)
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!