필터 지우기
필터 지우기

Re: find()

조회 수: 3 (최근 30일)
John Kim
John Kim 2016년 9월 6일
답변: Star Strider 2016년 9월 6일
Dear all,
Hi, I have a question regarding find(). Does find() always return a vector containing the linear indices IN ASCENDING ORDER? I guess it does, but I cannot find documentation to that effect.
I'd much appreciate your help. Thanks very much!
Best,
John

답변 (2개)

George
George 2016년 9월 6일
From what I can tell in the find documentation the answer is yes. The doc states that the find function "...returns the first n indices corresponding to the nonzero elements in X." (or if n is omitted it returns all of them)
The existence of the last directionallity argument further supports this by finding the last n elements.

Star Strider
Star Strider 2016년 9월 6일
It does, at least as I read the documentation.
The relevant part of the find documentation is the Linear Indices section. A link at the end of that page points you to Matrix Indexing and specifically to the section on Linear Indexing. This section discusses the way MATLAB stores and indexes vectors and matrices.
Note that this relates specifically to linear indexing of vectors and matrices. The find function allows you to return the row and column indices of a matrix as well, so what you get as a result depends on what you ask for.

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by