I have a data matrix, 2 columns and N rows. Lets call the columns x and y. I want all rows that meet teh following condition (X<25 and Y>30) to be nulled out of the original matrix and stored in a new matrix.

 채택된 답변

Rik
Rik 2020년 3월 4일

3 개 추천

Just use logical indexing:
N=100;data=randi(100,N,2)/2;%generate random data
L=data(:,1)<25 & data(:,2)>30;
newdata=data(L,:);
data(L,:)=[];

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Filter Banks에 대해 자세히 알아보기

제품

릴리스

R2018b

태그

질문:

2020년 3월 4일

댓글:

2020년 3월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by