Value of a variable not changing in the workspace ??
Ältere Kommentare anzeigen
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 Kommentare
Rik
am 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
am 18 Feb. 2019
Ramesh Bala
am 18 Feb. 2019
Rik
am 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
am 18 Feb. 2019
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Startup and Shutdown finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!