Value of a variable not changing in the workspace ??
이전 댓글 표시
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
Rik
2019년 2월 18일
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
2019년 2월 18일
Ramesh Bala
2019년 2월 18일
Rik
2019년 2월 18일
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
2019년 2월 18일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!