Initialization problem of the mask parameter when migrating from 2009a 2 2010b
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Kaustubha Govind
2013-4-25
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.
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Author Block Masks 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!