Info
Cette question est clôturée. Rouvrir pour modifier ou répondre.
How would I locate non-zeros given a condition?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Say that I have the matrix
1 0 1 1
0 0 0 1
0 0 0 0
and I want to find the row with a non-zero in the 4th column and at least 1 more non-zero in columns 1-3. Anyone know how I would approach this?
Réponses (1)
Alex Mcaulley
le 28 Jan 2020
For example:
A = [1 0 1 1
0 0 0 1
0 0 0 0];
rows = find(A(:,4) & sum(A(:,1:3)~=0,2));
1 commentaire
Cette question est clôturée.
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!