Finding position of a multidimensional array given manual value
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello,
I have the following:
[max_val, position] = max(sh(:)); %Gets max value of sh and provides position
[yAxInd,yCxInd,yVxInd] = ind2sub(size(sh),position); % Given position it provides me with the multidemnsional parameters
--------------
Is there any way i can provide the value myself to then get the parameters? Something like this..
[position] = [MyInput]; % User looking for position of a particular value
[yAxInd,yCxInd,yVxInd] = ind2sub(size(sh),position); %Given position it provides me with the multidemnsional parameters
Thanks! Appreciate the help!
0 commentaires
Réponse acceptée
Matt J
le 19 Déc 2021
Modifié(e) : Matt J
le 19 Déc 2021
Your question is a little unclear to me, but I think you mean this:
[yAxInd,yCxInd,yVxInd] = ind2sub(size(sh),find(sh==value))
4 commentaires
Matt J
le 20 Déc 2021
It is of course possible that there may be no matches or many. The code has succeeded in either case.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Matrix Indexing 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!