Command window help

When ever I run my script in matlab, after it is done, the >> in the command window won't show up after, and also I am unable to close MATLAB without ending the task. Does anyone know how I can avoid this happening?

답변 (2개)

Walter Roberson
Walter Roberson 2011년 3월 8일

0 개 추천

Is Matlab continuing to say that it is Busy ?
You have tried control-c to interrupt ?
Do you have any uiwait() or pause() calls in the script, or any loops?
We might need to see the script to give a better answer.

댓글 수: 1

Leo
Leo 2011년 3월 8일
it says it is busy.. here is my script.
I = input('Please enter the intial ammount put in the account: ');
T = input('Please enter the target ammount for the account: ');
Y=0;
while T ~= I*(1.05^Y);
Y = Y+1;
end
fprintf('It will take %i years to save up for your target ammount.',Y);

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

Andreas Goser
Andreas Goser 2011년 3월 8일

0 개 추천

Your WHILE loop just stops when T is EXACTLY I*(1.05^Y). If it is not exact the same (more than 2.2204e-016 makes it fail), the loop will never stop.
Try
while T > I*(1.05^Y);

카테고리

도움말 센터File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

질문:

Leo
2011년 3월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by