how can i find the element value from big counter

1 view (last 30 days)
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

Accepted Answer

Image Analyst
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
Shah
Shah on 25 Nov 2013
i send you whole problem in message... please help me in that
Image Analyst
Image Analyst on 25 Nov 2013
I don't take email about Answers. You can attach files here.

Sign in to comment.

More Answers (1)

Se Hyeon Cheon
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
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.

Sign in to comment.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!