Value of a variable not changing in the workspace ??
Mostra commenti meno recenti
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 Commenti
Rik
il 18 Feb 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
il 18 Feb 2019
Ramesh Bala
il 18 Feb 2019
Rik
il 18 Feb 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
il 18 Feb 2019
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Startup and Shutdown in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!