Azzera filtri
Azzera filtri

last cell is storing too many garbage values

1 visualizzazione (ultimi 30 giorni)
SOUVIK DATTA
SOUVIK DATTA il 17 Mag 2019
Commentato: Guillaume il 17 Mag 2019
whenever i am running this loop the last cell is storing too many (say 200) garbage values along with the actual values, how to remove them?.
y3=0;
for i=1:1
for j2=2:dl
h1 =sqrt(( xcor(i)- xcor(j2))^2 + ( ycor(i)- ycor(j2))^2);
for i1=2:8
if (h1 > LagClass(i1-1) & h1<= LagClass(i1-1)+lagint)
y3=y3+1;
GradeInClass{i1}(y3,:)= z(j2);
end
end
end
end
Thank you,
souvik
  1 Commento
Guillaume
Guillaume il 17 Mag 2019
Your code has no comment explaining what it's meant to do. How can we tell what is wrong with it?
Certainly, this line:
GradeInClass{i1}(y3,:)= z(j2);
is very bizarre. For a start you're using : which implies you're going to store a vector in GradeInClass{i1} but you're storing the scalar value z(j2). Secondly, since y3 increments each time you're storing something, you're going to end up with lots of empty rows in each GradeInClass element.
It's very unclear what you're trying to do but I would suspect that the line above is completely wrong.
Also puzzling:
for i = 1:1
This is only going to run once. It's just equivalent to
i = 1;

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Startup and Shutdown in Help Center e File Exchange

Prodotti


Release

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by