MATLAB: How to modify the signal properties from a Simulink model in Simulink 6.2 (R14SP2) from the command line

achangecommandfrominlinemodelofpropertiessignalsimulink

I want to set the "RTW storage class" of a signal from an Inport block to "ExportedGlobal" from the MATLAB command prompt.
In Simulink, this option is available under "Signal Properties -> Real-Time Workshop" tab after you right-click on the signal.

Best Answer

You can modify the signal properties by using the SET_PARAM function. For example:
Download the attached model and open it.
test.mdl
The signal from the Inport is named as 'The_Signal'. The "RTW storage class" for this signal can be set by executing the following code at the MATLAB command prompt:
theports=get_param('test/In1','porthandles'); %Get the port handles
outport = theports.Outport;
By default, the "RTW Storage class" is set to "Auto". To change the class to "ExportedGlobal" type the following at MATLAB command prompt.
set_param(outport,'RTWStorageClass','ExportedGlobal');