Effacer les filtres
Effacer les filtres

Re: find()

3 vues (au cours des 30 derniers jours)
John Kim
John Kim le 6 Sep 2016
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

Réponses (2)

George
George le 6 Sep 2016
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 le 6 Sep 2016
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.

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by