フィルターのクリア

Merge of Logical Indexing one dimension matrix from multi dimension?

5 ビュー (過去 30 日間)
Lin Nuo
Lin Nuo 2019 年 11 月 27 日
編集済み: Lin Nuo 2019 年 11 月 27 日
A = [
0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 1 0 0 0 1 1 1 0 0 ;
0 0 0 1 1 0 0 1 1 1 1 0 1 1 0 0 0 1 0 0 1 0 1 0 0 ;
0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 0 0 ;
0 0 0 0 0 1 0 1 1 1 1 1 1 1 0 0 0 1 0 0 0 1 1 0 0 ;
0 0 0 0 0 0 0 0 0 1 1 0 1 1 0 0 0 0 0 0 1 1 1 0 0];
Can we only extract existing values of 1 from many rows? For examples the result is:
Result = [
0 0 0 0 0 0 0 0 0 1 1 0 1 1 0 0 0 0 0 0 0 0 1 0 0];
Only one row. Without looping and IF.
*note: The matrix A is only for display. We can copy and paste, but need to adjust the matrix.

採用された回答

Fangjun Jiang
Fangjun Jiang 2019 年 11 月 27 日
all(A)
  1 件のコメント
Lin Nuo
Lin Nuo 2019 年 11 月 27 日
編集済み: Lin Nuo 2019 年 11 月 27 日
oo my God. Awesome. Out of my mind. :D. Thank you.

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by