MATLAB Answers

pouya jamali

Export states to workspace in simulink configuration parameters

Asked by pouya jamali
on 17 Nov 2012

when I choose to export the states to workspace in my Simulink Blockdiagram a variable is built in the workspace with the name "sout" this variable is a double variable which has a lot of columns. How can I realize that which column does relate to the desired state? My MATLAB engine is R2012b.


1 Answer

Answer by Ryan G
on 19 Nov 2012
 Accepted answer

Checkout the save and restore simulation states page.

On that page you'll see some parameters you can set programatically to find more information when you save the state:

set_param(mdl, 'SaveFinalState', 'on', 'FinalStateName',...
[mdl 'SimState'],'SaveCompleteFinalSimState', 'on');

This will save the state as mdlNameSimState and you can find the names of the states using:




The states in the form you are saving them as are useful for easy access since it is simply vector in the proper order for the model to be easily manipulated or stored.

  1 Comment

Thanks a lot Ryan for your support...

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!