Row and column of minim value from 3D matrix
Show older comments
Hello,
I've been looking for a method to do this since yesterday. I found some helpful answers here and the one which helps me the most still does not give me the best result.
I am trying to find the row and column of a matrix A = (:,:,eachUser) .
The column values are the one I need but the row values are totally different from what I have to obtain, unless the first one ( out of 10) which is always ok.
Any suggestions would be much appreciated. Thanks!
LE: I have the matrix A(row,column,User) and for each User I have the rows and columns. I want the minimum value from each row x column for each USER and it's index in order to calculate the exact position in the A matrix.
for eachUser = 1:length(Users_coordinates)
UsersDistance(:,:,eachUser) = ManhattanDistanceSum_2(:,:,eachUser);
[minimumV1(:,:,eachUser),indexMinimFirst(:,:,eachUser)]= min(UsersDistance(:,:,eachUser));
[minimumV2(:,:,eachUser) , indexMinimSecond(:,:,eachUser)] = min(minimumV1(:,:,eachUser));
rowV2(:,:,eachUser) = ind2sub(size(UsersDistance(:,:,eachUser)),indexMinimFirst(indexMinimSecond(:,:,eachUser)));
columnV2(:,:,eachUser) = ind2sub(size(UsersDistance(:,:,eachUser)),indexMinimSecond(:,:,eachUser));
% ErrorPositioning(eachUser) = myerrordistance(row(:,:,eachUser),Users_coordinates(eachUser,1), col(:,:,eachUser),Users_coordinates(eachUser,2));
end
Accepted Answer
More Answers (0)
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!