find the index of non-zero elements of three dimensional matrix and rank the them according to the value
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
For a three dimentional matrix: A=randi(10,[10 10 5]), I want to find the index (x,y,z) of each non-zero element of A and then rank the all the non-zero elements according to the value.
However, when running the following code, it seems 'find' can only have three outputs. May I know how to achive this?
A=randi(10,[10 10 5]);
[x,y,z,val]=find(A);
sortrows([val,x,y,z],1)
0 commentaires
Réponse acceptée
Rik
le 11 Juin 2018
A=randi(10,[10 10 5]);
[x,y,z,val]=findND(A);
sortrows([val,x,y,z],1)
2 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Resizing and Reshaping Matrices dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!