Sinulink S-function block blank parameter error-MATLAB2011b
显示 更早的评论
Hello,
I am using a user defined S-function Simulink block. I have two parameters inside it: 'DesignName' and 'DesignPath'. Both parameters are blank at the start of the application.
At some point I try to use "set_param" to set values to these parameters. I receive the following error:
" Parameter 'DesignName' setting: "" cannot be evaluated. Error: This statement is incomplete."
However, although I receive this error the correct value is still set.
The error causes my application not to work. When I run the same code on 2011a I do not receive this error and my application completes successfully.
I see the same phenomena when I try to set these parameters with the values manually, using the Simulink GUI.
Are you familiar with such a problem?
Thank you in advance,
Gilad
2 个评论
Kaustubha Govind
2011-11-9
Could you show us the exact set_param statement that you use to set the parameter? Typically, set_param causes the value to be set on the block even if there is an error (although simulation will not proceed because of the error).
Gilad
2011-11-10
回答(1 个)
Kaustubha Govind
2011-11-10
Could you try changing that to:
set_param([modelName '/' modelName '_HW_block'], 'DesignName', modelName);
You shouldn't need to put single quotes around a variable that is already a string. You only need that if you're doing something like:
set_param([modelName '/' modelName '_HW_block'], 'DesignName', 'mymodel');
It is possible that SET_PARAM was made more robust to the extra apostrophes in R2011a.
9 个评论
Gilad
2011-11-10
Kaustubha Govind
2011-11-10
Strange - can you reproduce this outside of your application? That is, open the corresponding model, and perform the set_param command? What is the value of modelName?
Gilad
2011-11-13
Kaustubha Govind
2011-11-14
Do you mean that you're setting the value of the "S-function parameters" dialog box? I don't think the S-function block has a parameter called DesignName.
Gilad
2011-11-15
Kaustubha Govind
2011-11-15
So, just to be clear, you do something like:
set_param('path/to/S-Function', 'DesignName', 'somevalue')
Is this correct?
Gilad
2011-11-16
Kaustubha Govind
2011-11-16
Okay, great! Hopefully your distributor's advice will help. I'm thinking that I don't see the full picture because of how the mask on your S-function is handling the value - there might be some callback code on the mask that is run every time a set_param is performed.
Gilad
2011-11-17
类别
在 帮助中心 和 File Exchange 中查找有关 Modeling 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!