Single coloumn if columns = 1
Afficher commentaires plus anciens
Hi everyone, i have a logical array P 378812x400 logical.
I want to create a single column that has the value of row 1 if in the 400 columns at least 1 row was 1.
I tried with this, but it does not run:
N=400
for j=1:N-1
for i=2:N
Q=or(P(:,j), P (:,i));
end
end
Thank you.
4 commentaires
madhan ravi
le 4 Déc 2018
Modifié(e) : madhan ravi
le 4 Déc 2018
just give a small example and your desired result ?
Riccardo Rossi
le 4 Déc 2018
Stephen23
le 4 Déc 2018
any(P,2)
Riccardo Rossi
le 4 Déc 2018
Réponses (2)
KSSV
le 4 Déc 2018
P = round(rand(10,3)) ;
idx = find(any(P,2))
Read about any
madhan ravi
le 4 Déc 2018
Q=sum(P,2)
Catégories
En savoir plus sur Image Arithmetic dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!