Thread Subject: how can I stop running the loop without terminating m-file?

Subject: how can I stop running the loop without terminating m-file?

From: Il Yoon

Date: 3 Jan, 2008 16:54:17

Message: 1 of 2

Hello all,
I am posting my question again here cause I couldn't get
the solutions that satisfy me.

Could you see the following simple m-file.


data_temporary=rand(10000,1000);
for i=1:100000
    plot(data_temporaty(i,:));
    pause(0.15)
end



This is for seeing the variation of profile of
matrix 'data_temporaty' continuously like animation.
I want to stop the plotting by typing 's' or 'Enter' or
something other keyboard.
How can I stop the ploting without terminating the m-file?
I mean, I don't want to use ctrl+c.

Someone told me to use 'dbloop.m'. But, honestly speaking,
it is too complicated for me to use.

Thank you in advance.

Il Yoon


Subject: how can I stop running the loop without terminating m-file?

From: Huy

Date: 3 Jan, 2008 17:23:36

Message: 2 of 2

Il Yoon,

In my experience, there are some ways to do that.

  1/ If your program has its figure, you can exploit the
properties of this figure to check your Keypress event
      - CurrentCharacter
      - KeyPressFcn
    
    Ex: set(gcf,'KeyPressFcn',...
            'get(gcf,''CurrentCharacter'')')

    Then, any character typed in current figure will be
printed in the command window.
    
   2/ If your program does not have any guide, you can
creat a guide to check KEYEVENT, or you can use java with
getKeyCode.

   3/ If you know PSYCHTOOLBOX, you can use their available
java function to check KEYEVENT:
     KbCheck, ...


Hope you can find your solution.

Anh Huy Phan
RIKEN - BSI
     

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
keyevent Anh Huy Phan 3 Jan, 2008 12:25:05
rssFeed for this Thread

Public Submission Policy

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.

Contact us at files@mathworks.com