Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

GUIDE MATLAB - Temporarily stopping the execution and reception of data from one program

Asked by Ivan

Ivan (view profile)

on 7 Aug 2013

Good day,

I'm doing a GUIDE in which receiving data to matlab workspace from another application via TCP / IP. At some point wish to stop this application and then restart after a while again. I tried with the command to interrupt "Ctrl+C" this, but I have not accomplished anything. Also I reviewed earlier post like this:

http://www.mathworks.com/matlabcentral/answers/14180-cancel-running-program-with-crtl-c-is-it-possible-to-recover-the-processed-data

I hope your answers and comments

thank you, best regards

0 Comments

Ivan

Ivan (view profile)

Tags

Products

2 Answers

Answer by kjetil87

kjetil87 (view profile)

on 8 Aug 2013
Edited by kjetil87

kjetil87 (view profile)

on 8 Aug 2013
Accepted answer

I often use a simple and easy method of stopping functions.It is easiest and cleanest if you are say reading in a loop or something like that.

Example:

PAUSE_FILE='pause.txt';
while condition
    %"do some stuff"
    if exist(PAUSE_FILE,'file')
       delete(PAUSE_FILE);
       keyboard;  
    end
end

When you want to pause your program you simply create an empty txt file called "pause.txt" in the current matlab folder,and when you want to continue you can just type

 K>>return

in the matlab command prompt when you want to continue. I like it because the best way is often to keep it as simple as possible and you have full control over where you program pauses.

Hope it helps =)

0 Comments

kjetil87

kjetil87 (view profile)

Answer by Ivan

Ivan (view profile)

on 12 Aug 2013

Thanks kjetil87 for the answer..

Best regards

0 Comments

Ivan

Ivan (view profile)

Contact us