How to compare rows of a matric?

1 vue (au cours des 30 derniers jours)
Harsha M V
Harsha M V le 3 Sep 2021
Modifié(e) : KSSV le 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?

Réponse acceptée

KSSV
KSSV le 3 Sep 2021
Modifié(e) : KSSV le 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.

Plus de réponses (0)

Catégories

En savoir plus sur Shifting and Sorting Matrices dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by