Finding position of a multidimensional array given manual value
1 回表示 (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
Matt J
2021 年 12 月 19 日
編集済み: Matt J
2021 年 12 月 19 日
Your question is a little unclear to me, but I think you mean this:
[yAxInd,yCxInd,yVxInd] = ind2sub(size(sh),find(sh==value))
4 件のコメント
Matt J
2021 年 12 月 20 日
It is of course possible that there may be no matches or many. The code has succeeded in either case.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Matrix Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!