フィルターのクリア

Make a logical array into a single logical column, if any of the array rows contain a 1

11 ビュー (過去 30 日間)
Hi Guys i have a logical array of the size 10617x21 named a. I need it to be 10617x1 named b, so only one column.
One condition, if there was a 1 anywhere in the row on a, then i would like the row value of b to also be 1.
Smaller example:

採用された回答

Chunru
Chunru 2021 年 11 月 30 日
a = [0 0 0; 1 0 0; 0 1 0; 0 0 0]
a = 4×3
0 0 0 1 0 0 0 1 0 0 0 0
b = any(a==1, 2)
b = 4×1 logical array
0 1 1 0
  1 件のコメント
Magnus Rasmussen
Magnus Rasmussen 2021 年 12 月 1 日
Thank you. This was a simple solution, but it will also help me in the future

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by