MATLAB: Do I get an error when entering or indexing into an array of Simulink.Parameter objects as a block parameter in Simulink 7.8 (R2011b)

arrayblockobjectparametersimulink

I am working with Simulink blocks that can take in parameters from edit boxes. In addition to, for example, numerical values, I can enter a variable name corresponding to a Simulink.Parameter object. This works fine for a single object, but not when indexing into an array of objects or when indexing into an array contained in an object.
For example:
a(1) = Simulink.Parameter;
a(2) = Simulink.Parameter;
If we type "a(1)" into the Mask parameter edit box, the following error comes up in a pop-up window:
"Error due to multiple causes. --> Variable 'a' is resolved in workspace ('base') for block 'BLOCKNAME' but it is an array of objects".
However, creating a variable "a1" and using that as the parameter in the mask works fine:
a1 = a(1);
In addition, let us say we have a double array b = [1 2]. Using "b(1)" as the Mask parameter also works fine.
Why is this?

Best Answer

The ability to use arrays of objects in blocks is currently unavailable in Simulink 7.8 (R2011b).
As a workaround, variables that index into object arrays can be defined in model callbacks, or in the workspace. For example, two variables "a1" and "a2" can be defined, which point to the first and second elements of an object array "a":
a1 = a(1);
a2 = a(2);
In order to create model callbacks, you can take the following steps:
1. Open up the model.
2. On the menu at the top of the model, go to "File > Model Properties".
3. Under the "Callbacks" tab, you can fill in various model callbacks that can run when initalizing the model, starting simulations, etc.
For more information on model callbacks, please refer to the following documentation link:
<http://www.mathworks.com/help/releases/R2011b/toolbox/simulink/ug/f4-122589.html#f4-56417>