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

How can I return from simulink to matlab thread?

Asked by Gun-min Kim on 18 May 2012

Hi ! I am currently doing 'real-time audio processing' using simulink and matlab.

Firsly, I built system block for simulink ('record_test.mdl') like this. (

Followings are my MATLAB code(.mfile).

(other codes...)

But the process doesn't return from simulink to MATLAB at all.

Is there anyone who can give me some advice? I really appreciate all of your comments.


Kaustubha Govind on 18 May 2012

Do you mean the SIM command hangs your MATLAB script?

Yash on 9 Jul 2012

yes this will happen in SIM when working with real time audeio

Gun-min Kim



1 Answer

Answer by Guy Rouleau on 18 May 2012
Accepted answer

SIM is blocking, it will return to your script only when the simulation terminates.

If you want to start a simulation from command line in a non-blocking way, you can use:


That way your script will continue to the next line once the simulation is started, without waiting for it to complete.

1 Comment

K E on 10 Jul 2012

I did not know this, so thanks.

Guy Rouleau

Contact us