Getting dimension indexes based on element index
Show older comments
Hi,
I have a 5D matrix, I found the minimum value and minimum index along the whole elements.
How can I know this minimum belongs to which row, which column, which page. I mean for example if the minimum index is 1108.
How can I know at which row, column and pages, this elmentes locates?
Thanks.
Accepted Answer
More Answers (1)
a = randn(2,3,4,5,6);
[amin, i]=min(a(:))
[i1, i2, i3, i4, i5] = ind2sub([2,3,4,5,6], i)
1 Comment
Zahra Yousefi Darani
on 30 Aug 2022
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!