フィルターのクリア

Breaking up matrix by values in column

1 回表示 (過去 30 日間)
Christopher
Christopher 2013 年 11 月 15 日
コメント済み: Christopher 2013 年 11 月 16 日
Hello all,
I am trying to figure out a way to break up a 100 x 7 matrix by values in the last column. I will give a short example, which should explain it very well. It goes as follows:
matrix=[1 1 1 1;2 2 2 2; 3 3 3 3;3 3 3 3;4 4 4 4;4 4 4 4;5 5 5 5;5 5 5 5]
I then want to break this matrix up by values in the last column. So for example I want to obtain a new matrix for the range of 2 to 4 in the last column. So the new matrix would be:
matrix=[2 2 2 2;3 3 3 3;3 3 3 3;4 4 4 4;4 4 4 4];
I cannot figure out a good way to make this work. Any help would be great.

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 11 月 15 日
編集済み: Azzi Abdelmalek 2013 年 11 月 15 日
c=matrix(:,end) ;
out=matrix(c>=2 & c<=4,:)
  1 件のコメント
Christopher
Christopher 2013 年 11 月 16 日
Thanks!

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

その他の回答 (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