Effacer les filtres
Effacer les filtres

last cell is storing too many garbage values

1 vue (au cours des 30 derniers jours)
SOUVIK DATTA
SOUVIK DATTA le 17 Mai 2019
Commenté : Guillaume le 17 Mai 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 commentaire
Guillaume
Guillaume le 17 Mai 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;

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Startup and Shutdown dans Help Center et File Exchange

Tags

Produits


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by