How can I plot before running through calculations in a function?
이전 댓글 표시
I have a plotting function embedded in a larger function. I would like to have the plot show up before it is finished with all the number crunching. The over all function takes a while to run and I would like to be able to check the plot to ensure all of the inputs are correct before waiting for it to finish the rest of the function. Is there any way to accomplish this?
Thanks,
-Jeremy
댓글 수: 2
Matt Kindig
2012년 10월 25일
I suppose you want to plot the inputs, and then allow the user to verify that the inputs look good before continuing? If so, a simple way is to insert a 'pause' command after the plotting is performed. That forces the user to press the space bar (after visually confirming the inputs are valid), before continuing.
doc pause
You could even make it more sophisticated, by allowing the user to select whether to continue with the function running, or jump out now. Something like this:
s = input('Are inputs valid (y/n)? ', 's');
if ~strcmpi(s, 'y'), %if not a 'y' answer,
return; %exit function now
end
Jeremy
2012년 11월 2일
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Graphics Performance에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!