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)=[];

 Akzeptierte Antwort

VBBV
VBBV am 1 Dez. 2020

1 Stimme

AA(AA<1|AA>2) = []

1 Kommentar

Andrew Stark
Andrew Stark am 1 Dez. 2020
Is there a way to leave it empty so that the matrix is the same size?

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Hilfe-Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by