How to extract rows based on a particular column values in a matrix?

33 ビュー (過去 30 日間)
Joydeb Saha
Joydeb Saha 2020 年 11 月 9 日
回答済み: Subhadeep Koley 2020 年 11 月 9 日
I have attached a .mat file. It has two columns. In the second column if the values are greater than equal to 1 or if the values are less than equal to -1 the code will take the complete row and I'll get a new matrix. How to do it

採用された回答

Subhadeep Koley
Subhadeep Koley 2020 年 11 月 9 日
load 'D.mat';
D_new = D((D(:, 2) >= 1) | (D(:, 2) <= -1), :);

その他の回答 (1 件)

KSSV
KSSV 2020 年 11 月 9 日
load D.mat ;
A = D(D(:,2)>=1,:) ;
B = D(D(:,2)<=-1,:) ;

カテゴリ

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