Finding position of a multidimensional array given manual value
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Akzeptierte Antwort
Matt J
am 19 Dez. 2021
Bearbeitet: Matt J
am 19 Dez. 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 Kommentare
Matt J
am 20 Dez. 2021
It is of course possible that there may be no matches or many. The code has succeeded in either case.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!