MATLAB Answers

or operation on the columns of a matrix ?

조회 수: 3(최근 30일)
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

로그인 to comment.

채택된 답변

Image Analyst
Image Analyst 12 May 2019
Try
rowHasOnes = any(S, 2);
If not, then supply an example S and the expected result.

  댓글 수: 1

Nora Khaled
Nora Khaled 12 May 2019
Thank you!! this works.

로그인 to comment.

More Answers (0)

이 질문에 답변하려면 로그인을(를) 수행하십시오.


Translated by