how can i find the element value from big counter
1 view (last 30 days)
Show older comments
how can i find the element number from big counter for example count = 1:500
I want to know the element value of 1, 108, 297, and 451
I need the a command
0 Comments
Accepted Answer
Image Analyst
on 25 Nov 2013
Edited: Image Analyst
on 25 Nov 2013
See this snippet/example:
m = [1, 108, 297, 451, 108, 297, 42]
index = find(m == 1)
index = find(m == 108)
index = find(m == 108, 1, 'first')
index = find(m == 108, 1, 'last')
index = find(m == 297)
In the command window:
m =
1 108 297 451 108 297 42
index =
1
index =
2 5
index =
2
index =
5
index =
3 6
Or this:
count = int32(1 : 500);
index = find(count == 1)
index = find(count == 108)
index = find(count == 297)
index = find(count == 451)
5 Comments
More Answers (1)
Se Hyeon Cheon
on 25 Nov 2013
You may use 'find'.
fi = find(data == 1);
or
fi = find(data == 108);
....
Good luck!
3 Comments
Image Analyst
on 25 Nov 2013
Your comment is not helpful. We don't know why it does not work. Please give an example of how it's not working.
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!