Creating sub-matrices using one matrix

2 ビュー (過去 30 日間)
Rengin
Rengin 2014 年 3 月 21 日
編集済み: Thomas 2014 年 3 月 21 日
Let's say I have such a matrix:
A=[1 3;2 4;2 5;0 0;4 5;4 7;0 0;5 6;0 0 ] %I want to divide it into submatrices limiting with [0 0]
B=[1 3;2 4;2 5] C=[4 5;4 7] D=[5 6]
Thank you for your time!

回答 (1 件)

Thomas
Thomas 2014 年 3 月 21 日
編集済み: Thomas 2014 年 3 月 21 日
  2 件のコメント
Rengin
Rengin 2014 年 3 月 21 日
My question is beyond the extracting randomly rows and columns, meeting a condition to extract sub-matrices limted with [0,0]
Thomas
Thomas 2014 年 3 月 21 日
編集済み: Thomas 2014 年 3 月 21 日
You could easily find the [0 0] rows and use indexing to get the submatrices..
find(all(A==0,2))
ans =
4.00
7.00
9.00
These are your zero rows .. now index appropriately to create your new sub matrices..

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

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by