Re: find()
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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
0 Commenti
Risposte (2)
George
il 6 Set 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.
0 Commenti
Star Strider
il 6 Set 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.
0 Commenti
Vedere anche
Categorie
Scopri di più su Logical in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!