Value of a variable not changing in the workspace ??
Afficher commentaires plus anciens
The value of j goes upto 1025 but i stays at 255 itself ,what's the error in this nested loop??
X = load('x.mat');
Y = load('y.mat');
for i=245:61503
i = i+10;
for j=1:1024
j=j+1;
figure(); hold on
plot(Y.y(1:i,j))
set(0,'DefaultFigureWindowStyle','docked')
end
end
hold off
5 commentaires
Rik
le 18 Fév 2019
Why would you change your loop indices like that? If you want them to have those values, why not change them in your call to for? Also, what give you the impression that j stays at 255? Do you get an error? Why are you opening 1024 figures? That seems like it is not visually usefull and will probably cause performance issues.
As a last remark: I would discourage the use of i and j as loop variables. They may cause confusion (and bugs) as they are also the imaginary unit. If you want to use the imaginary unit, use 1i or 1j to avoid any ambiguity.
Ramesh Bala
le 18 Fév 2019
Ramesh Bala
le 18 Fév 2019
Rik
le 18 Fév 2019
Why don't you try explaining what you want to do? That way we can try to solve your actual issue, instead of the errors from your solution.
Ramesh Bala
le 18 Fév 2019
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Startup and Shutdown dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!