Clear Filters
Clear Filters

Initialization problem of the mask parameter when migrating from 2009a 2 2010b

1 view (last 30 days)
Hello everyone,
We are currently migrating some Simulink models from Matlab 2009b to Matlab 2010b.
These models involve by several masked blocks, which we used to define some mask parameters These parameters are used inside the masked block as the value of a constant block or as the initial condition of the integrator. For these parameters we wrote an initialization into the initialization tab of the mask.
For example for the mask variable CI the initialization is made in the following way
CI = @1
this instruction let us to retrieve the value of the first variable of the mask dialogbox, (which is CI).
This assignment normally works without any warning message on Matlab 2009. But if we run the model on matlab 2010 we experience the following warning message
"Warning The MaskInitialization string of block /Test FBloc_z_sf/FDFRES0 contains usage of mask variables by reference ( @1 @2) instead of by variable name.
Support for this usage will be removed in a future release
So in order to make the model compatible with the future release of Matlab. We are currently looking for a way to change this assignment into the initialization tab of the mask.
The first attempt to change the reference @1 by the the variable name as suggested on the warning message
For example
CI = @1 -> I changed in -> CI = min_tens
But unfortunately it doesn't work and I have this error message popping up
'Undefined function min_tens'
which is weird, because this variable is defined in the base workspace.
So I modified the script inside the initialization tab of the mask by
CI=str2num(get_param(gcb,'CI'))
but it doesn't work neither
Right now I'm out of ideas. Is there another way? Do you have any suggestions ?
Thanks for reading
  3 Comments

Sign in to comment.

Accepted Answer

Kaustubha Govind
Kaustubha Govind on 25 Apr 2013
If the name of the mask parameter is 'CI', I don't think you need to initialize CI again. I think it should already be holding the value of the parameter named 'CI', since each parameter has a variable if the same named associated with it in the Mask Workspace.

More Answers (0)

Categories

Find more on Simulink Functions in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!