lowest index in the matrix
1 view (last 30 days)
Show older comments
Hi,
I try to find a lowest index in the each row of the matrix.For example I have 4x6 matrices like this
A = 1.9440 1.9749 1.9442 1.9786
1.9752 1.9699 1.9732 1.9646
1.9678 1.9580 1.9120 1.9129
1.9199 1.9117 1.9138 1.9074
1.9117 1.9302 1.8998 1.9165
1.9060 1.9180 1.9116 1.9056
1.9113 1.9040 1.9051 1.9051
First rows lowest value is 1.9440 and index is 1, second rows lowest value is 1.9616 and index is 4 etc. because i need to use that index to find in the other matrices.
B= 2.3309 2.5192 2.4977 2.4928
2.4410 2.4246 2.6200 2.4092
2.3714 2.3964 2.6079 2.5904
2.4682 2.5127 2.5259 2.5475
2.4757 2.4680 2.3819 2.5908
2.6394 2.5099 2.5651 2.4873
Because the index of the lowest value at the first row in matrices A, I want same index for B.
lowest A = 1.9440 1.9646 1.9120 1.9074 1.8998 1.9056 1.9040
index = 1 4 3 4 3 4 2
intended results according to this index in matrices B =
2.3309 2.4092 2.6079 2.5904 2.3819 2.5099
Thank you
0 Comments
Accepted Answer
Sean de Wolski
on 14 Oct 2013
The second output of min() gives you this:
[minx,idx] = min(A,[],1);
And for more info:
doc min
0 Comments
More Answers (0)
See Also
Categories
Find more on Matrices and Arrays 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!