or operation on the columns of a matrix ?
21 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Nora Khaled
le 12 Mai 2019
Commenté : Nora Khaled
le 15 Sep 2020
Hello!
I have matrix S that contains zeros and ones. and I want to convert it to a column vector contianing one in the ith position if there was at least one one in the ith row.
So I know that "or" operation does similar job but with two vectors. is there a way to use it with the columns of S ?
0 commentaires
Réponse acceptée
Image Analyst
le 12 Mai 2019
Try
rowHasOnes = any(S, 2);
If not, then supply an example S and the expected result.
3 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Matrices and Arrays 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!