How to make successive for loops?!

조회 수: 2 (최근 30일)
Mariam Sheha
Mariam Sheha 2016년 4월 1일
편집: Mariam Sheha 2016년 4월 8일
Hey everybody;
i want to make 3 successive loops that the next loop start from the end of the previous ....can any one help me through that?!
code is attached

채택된 답변

Torsten
Torsten 2016년 4월 8일
If you compare with my code, you'll notice that the use of i2 and i3 in these lines is not correct.
v2(i2)=70.*w1;
u2(i2)=70.*w12;
x2(i2)= y1(i+1);
y2(i2)=y1(i+1);
v2(i3)=30.*w2;
u2(i3)=30.*w22;
x2(i3)=y1(i2+1);
y2(i3)=y1(i2+1);
Furthermore, I never introduced v2,u2,x2,y2.
Best wishes
Torsten.
  댓글 수: 1
Mariam Sheha
Mariam Sheha 2016년 4월 8일
편집: Mariam Sheha 2016년 4월 8일
Yes i got your point and i fixed out but the problem is that once i entered this lines in the loop it takes to long time (doesn't stop till i force close the program...) and if i remove it out of the loop, it warning out asking (what is i2?))
Noting that: i must introduce these parameters to work as an initial values for the second loop...
v2(i2)=50.*w1;
u2(i2)=50.*w12;
x2(i2)= y1(i);
y2(i2)=y1(i);
Thanks a lot for your continuous help

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Image Analyst
Image Analyst 2016년 4월 1일
It's basically like this. Adapt as needed:
for k1 = 1 : 4
k1 % Echo to command window
end
for k2 = (k1+1): (k1 + 5);
k2 % Echo to command window
end
for k3 = (k2+1): (k2 + 2);
k3 % Echo to command window
end
  댓글 수: 10
Mariam Sheha
Mariam Sheha 2016년 4월 1일
Torsten;
Great great thanks for your help and your answer, Many thanks..
your help makes my day :)
Mariam Sheha
Mariam Sheha 2016년 4월 8일
Hello Tosten;
Look i wrote the code that way as you guided me to but still error appeared with me could you help me out through that...cod is attached... Thanks

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by