Effacer les filtres
Effacer les filtres

Filtering data in matrices

1 vue (au cours des 30 derniers jours)
Andrew Stark
Andrew Stark le 1 Déc 2020
Commenté : Andrew Stark le 1 Déc 2020
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)=[];

Réponse acceptée

VBBV
VBBV le 1 Déc 2020
AA(AA<1|AA>2) = []
  1 commentaire
Andrew Stark
Andrew Stark le 1 Déc 2020
Is there a way to leave it empty so that the matrix is the same size?

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by