Filtering data in matrices

1 次查看(过去 30 天)
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 中查找有关 Logical 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by