MATLAB: How to set the size of a Simulink.Signal object using a Simulink.Parmeter object in order to implement a dimension variant signal

dimensiondimensionssimulinksimulink.parametersimulink.signalsymbolicvariant

I want to use a Simulink.Parameter object to set the size of a Simulink.Signal object in order to create a variant dimension in my generated code. For an Inport, I am able to do this by setting the "Dimensions" property to be a Simulink.Parameter object, but when I try to do this for a Simulink.Signal object, I see the following error:
 
Invalid 'Dimensions' property specified.
This property must be a double vector consisting of either positive elements such that their cumulative product is less than or equal to 2147483647,
or elements with the value -1 (to specify that the dimension's value is to be inherited from the signal).
Further, for signals of greater than 2 dimensions, the trailing dimension cannot have a value of 1.
How can I accomplish this?

Best Answer

To use symbolic dimensions, you must specify the dimension as a character vector. Thus, you could enter the following command in order to set the dimension of the signal object using the parameter object:
 
>> mySig.Dimensions = 'myParam';
Alternatively, you can set this property via the Model Explorer by entering 'myParam' in the "Dimensions" field of mySig.