Compare rows from different columns
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Scott Dean Seedell
il 17 Feb 2024
Risposto: Star Strider
il 17 Feb 2024
I'm sure this isn't difficult but my brain is struggling a little:
I want to compare two column vectors and see if any of the values in the 1st are larger than any of the corresponding values in the 2nd.
For instance, if row 8 is larger in the 2nd column than the 1st.
Or if row 6 is larger in the 2nd column than the 1st.
0 Commenti
Risposta accettata
Star Strider
il 17 Feb 2024
One approach —
A = randi(50,10,2)
Col_2_Larger = A(:,2) > A(:,1)
ColNr = find(Col_2_Larger);
fprintf('Col 2 larger in row %d\n', ColNr)
.
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su MRI in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!