From: khalid Al-Abri on
"Phil Goddard" <philgoddardNOSPAM(a)telus.net> wrote in message <g998bt$agp$1(a)fred.mathworks.com>...
>
> Note that Simulink does not write tout (or any other data)
> to the MATLAB workspace until the simulation is paused or
> stopped.
> (I'm assuming here that tout is the standard time variable
> created on the Data Input/Output panel of the model's
> Configuration Parameters.)
>
> Hence if you do not have a variable called tout ALREADY in
> your workspace then the code you give would never stop the
> model, it would run until the stop time specified in the
> model.
>
> There are several ways to achieve what you want.
> One would be to have the model accept intial (state)
> conditions from the workspace.
> That can be specified on the Data Input/Output page.
>
> Then you can use sim



> x0 = ...... % whatever you need
> in = ...... % whatever you want
> [t,xVec,y] = sim('model',[startTime pauseTime]);
>
> x0 = xVec(end,:); % ensure the next sim starts where the
> first one stopped
> in = ...... % the new values
> [t,xVec,y] = sim('model',[pauseTime stopTime]);
>
> Note that with the above code the simulation is being run
> twice, with each run being over a different time period.
> It is not being run once with a pause.
>
> Phil.
>

Hi Phil.

Can you please explain the above code , I mean what are mean t,y,x0 and xVec
because I need this code in my project

I hope to replay soon
and Thank you in advance