MATLAB Answers


how to send Data to workspace

How to send data to workspace continuosly whenever my simulink model has been paused by below code,,I am using a simple constant block and to workspace block
   for i=1:1:10
     set_param('SampleTest','StopTime', sprintf('%d',i)); 
  set_param('SampleTest', 'Simulationcommand', 'start') 
    set_param('SampleTest', 'Simulationcommand', 'update')
    set_param('SampleTest', 'Simulationcommand', 'continue')


I am trying this but data will come to base workspace oly after my code finishes 10 steps

Do you mean after 10, itterations?


1 Answer

Answer by Kaustubha Govind
on 7 Jan 2013
 Accepted answer

Please see the second paragraph in my answer here for an explanation of what you're seeing. If you'd like your workspace to be updated immediately, you might need to write your own MATLAB code to do this. You can follow the technique described in Access Block Data During Simulation to run your MATLAB code as soon as a new output value becomes available.

  1 Comment

I have found the solution,,,I avoided paassing variables value to workspace,,,rather am directly calling the values to next model wher i require them,,thanks for ur help i learnt usefull things

Join the 15-year community celebration.

Play games and win prizes!

Learn more
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

MATLAB Academy

New to MATLAB?

Learn MATLAB today!