MATLAB: Is it possible to generate the signal logging variable “logsout” in the workspace when running a model using the syntax: [t,x,y] = sim(‘model_name’) in Simulink 6.1 (R14SP1)

logginglogsoutsignalsimsimsetsimulink

In Simulink 6.1 (R14SP1), if signal logging is used in a model and the model is run with the syntax:
sim('test.mdl')
The "logsout" variable will be generated in the MATLAB base workspace. However, if the model is run with the syntax:
[t,x,y] = sim('test.mdl')
The "logsout" variable does not get generated. I would like a way to generate the variable using the second syntax.

Best Answer

This feature has been added in Simulink 6.2 (R14SP2). Now, Simulink creates the signal logging variable based on the configuration parameters of the model regardless of the syntax for the SIM command that you use.
Additionally, you can use the SIMSET command to override the model parameters. For example,
opts = simset('SignalLogging', 'on', 'SignalLoggingName', 'my_logsout_var'); [t,x,y]=sim('test.mdl',10,opts);
enables Signal Logging and creates a variable named 'my_logsout_var', even if Signal Logging is disabled in the model's configuration parameters. If you are using a previous version, read the following:
The ability to generate the "logsout" variable when using the the [t,x,y] = sim('model_name') syntax is not available in Simulink 6.1 (R14SP1). There are no workarounds.