How to compare rows of a matric?

4 views (last 30 days)
Harsha M V
Harsha M V on 3 Sep 2021
Edited: KSSV on 3 Sep 2021
I have a 50x4 matrix.
Here, how to find a row that all its elements are greater than the other elements of the rows in that matrix?

Accepted Answer

KSSV
KSSV on 3 Sep 2021
Edited: KSSV on 3 Sep 2021
A = rand(1,3) ; % your row
B = rand(3) ; % Say complete matrix
idx = A > B ; % comapre
r = find(sum(idx,2)==3) % find which row is greater
Run a loop for each row.

More Answers (0)

Categories

Find more on Shifting and Sorting Matrices 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!