Filtering data in matrices

2 ビュー (過去 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 Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by