filter data in matrix

19 ビュー (過去 30 日間)
MOH
MOH 2021 年 10 月 29 日
コメント済み: MOH 2021 年 10 月 29 日
I have a matrix with 500 rows and two columns, I want to filter the first column when the value < 100 it shoud be removed. so, the new matrix will have the filtered data for the 2 columns.
C is the matrix
filt = C(:,1)<100;
C(filt) = [];
this will remove the data but will only return the first coumn . I want to have the second one also corsponding to that filter.

採用された回答

KSSV
KSSV 2021 年 10 月 29 日
編集済み: KSSV 2021 年 10 月 29 日
Let A be your matrix of size m*2.
idx = A(:,1)<100 ; % get logical indices in first column less than 100
A(idx,:) = [] ; % remove those rows
You have to use :, which is read as all the.
  1 件のコメント
MOH
MOH 2021 年 10 月 29 日
thank you

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

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by