or operation on the columns of a matrix ?

25 ビュー (過去 30 日間)
Nora Khaled
Nora Khaled 2019 年 5 月 12 日
コメント済み: Nora Khaled 2020 年 9 月 15 日
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 ?

採用された回答

Image Analyst
Image Analyst 2019 年 5 月 12 日
Try
rowHasOnes = any(S, 2);
If not, then supply an example S and the expected result.
  3 件のコメント
Sanchari Thakur
Sanchari Thakur 2020 年 9 月 15 日
what is the 'and' version of the 'any' function?
Nora Khaled
Nora Khaled 2020 年 9 月 15 日
all(A) or all(A, dim)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by