Main Content

Workspace Parameter Data Type Limitations

If the data type of the MATLAB® work space parameter value does not match that of the block parameter used in your model, the value of the variable in the generated code is set to zero.

If you specify the type of the Simulink.Parameter object by using the DataType property, use a typed expression when assigning a value to the parameter object. For example, if the Simulink.Parameter object K1 is used to store a value of the type single, use a typed expression such as single(0.3) when assigning a value to K1.

K1 = Simulink.Parameter;
K1.Value = single(0.3);
K1.StorageClass = 'ExportedGlobal';
K1.DataType = 'single';