0
votes

First of all, matlab version is 2011b, so I cannot use Simulink.MaskParameters class.

I have one simulink mask and some parameters inside. I need to determine in my function for each parameter if it is "evaluable" or "tunable".

Those two things are two checkboxes in the mask parameters dialog which you can select for any parameter.

For "tunable", there's the MaskTunableValues property. For "enable", there's the "MaskEnables" property.

Do you know if there's a way to programmatically access the same property but for "evaluate" ? Thanks

3

3 Answers

3
votes

@Phil Goddard's answer shows you how to find the parameter. To complete the answer, the actual parameter is MaskVariables. Evaluate flag is embedded into the MaskVariables string. It is not straightforward to modify this. For example for two parameters MaskVariables string contains something like this:

"a=@1;b=&2;"

In this string the @ sign indicates evaluation. Based on that, parameter a is evaluated and parameter b is not. If you want to change the evaluate flag, you need to set this string for MaskVariables parameter exactly how it was except for @ or & signs.

For more information see R2011b documentation for mask parameters at https://www.mathworks.com/help/releases/R2011b/toolbox/simulink/slref/f23-18517.html. Towards the bottom of the page there is more detail about MaskVariables parameter.

2
votes

You're using too old a release for most people to be able to give you an exact solution, however, I'm sure (from memory) that this parameter is available.

If you click on the mask to select the block, then go to the MATLAB command line and type

get_param(gcb,'ObjectParameters')

you'll get a list of all the block properties. (You may already know that since you're aware of MaskTunableValues and MaskEnables.) Near the bottom of that list are all of the properties related to the mask.

Now manually look at each/all of those properties, e.g.

get_param(gcb,'MaskTunableValues')

and you'll find that one of them is a structure that contains the information that you're looking for. (You may need to dig down into the structure to find the specific info.)

1
votes

Answer for versions > 2011b (tested on 2014b):

Ok found it, actually the matlab documentation is REALLY unclear regarding the Simulink.MaskParameter class and here is how it works:

First, get the Mask class from your block:

mask = Simulink.Mask.get(gcb)

The Mask class is a structure containing all mask parameters:

parameters = mask.Parameters(:)

parameters is a (array of) Simulink.MaskParameter object which will contains all the necessary properties, including Evaluate.