How can i find "AND" or "OR" of rows in a matrix?

Hi friends,
I'm actually working on a matrix and i need to apply "and" logic operation on the rows. For example, if we have Matrix A with 3 rows and 10 columns, i want to find the Matrix B with size 1*10 which has the result of the operation (Row1) & (Row2) & (Row3).

回答 (1 件)

Matt Fig
Matt Fig 2011 年 5 月 14 日

1 投票

A = round(rand(3,10))
all(A) % A(1,:) & A(2,:) & A(3,:)
any(A) % A(1,:) | A(2,:) | A(3,:)

この質問は閉じられています。

質問済み:

2011 年 5 月 14 日

閉鎖済み:

2021 年 8 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by