how to obtain the last index of a column vector containg a set of given values?

I have a column vector which shows time. I'm trying to find out the index using the find command. My input command was. >> s=find(time==0.1000); >> s
s =
Empty matrix: 0-by-1
The vector contains three values of 0.1000.I want the index of the last value. But it shows the above error message.

답변 (1개)

Image Analyst
Image Analyst 2014년 2월 15일
The index of the last element of "time" or of any 1-D array is "end" or length(time).

댓글 수: 3

See the FAQ: http://matlab.wikia.com/wiki/FAQ#Why_is_0.3_-_0.2_-_0.1_.28or_similar.29_not_equal_to_zero.3F to see why you don't want to compare to 0.1 but need to check within a tolerance of 0.1.
I want the index of not the last element.i have used find command but still <= expression is not working

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

질문:

2014년 2월 15일

댓글:

2014년 2월 15일

Community Treasure Hunt

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

Start Hunting!

Translated by