Filtering data in matrices

조회 수: 3 (최근 30일)
Andrew Stark
Andrew Stark 2020년 12월 1일
댓글: Andrew Stark 2020년 12월 1일
AA=Df{1,1};
AAA=AA;
for i=1:length(AA)
if AA(i) <1 || AA(i)>2
AAA(i)=[];
end
end
I am trying to filter data that is between 2 values into a new matrix. Whenever I run this code I get the error
Matrix index is out of range for deletion.
Error in Analyze (line 279)
AAA(i)=[];

채택된 답변

VBBV
VBBV 2020년 12월 1일
AA(AA<1|AA>2) = []
  댓글 수: 1
Andrew Stark
Andrew Stark 2020년 12월 1일
Is there a way to leave it empty so that the matrix is the same size?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by