Sinulink S-function block blank parameter error-MATLAB2011b
Afficher commentaires plus anciens
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 commentaires
Kaustubha Govind
le 9 Nov 2011
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
le 10 Nov 2011
Réponses (1)
Kaustubha Govind
le 10 Nov 2011
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 commentaires
Gilad
le 10 Nov 2011
Kaustubha Govind
le 10 Nov 2011
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
le 13 Nov 2011
Kaustubha Govind
le 14 Nov 2011
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
le 15 Nov 2011
Kaustubha Govind
le 15 Nov 2011
So, just to be clear, you do something like:
set_param('path/to/S-Function', 'DesignName', 'somevalue')
Is this correct?
Gilad
le 16 Nov 2011
Kaustubha Govind
le 16 Nov 2011
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
le 17 Nov 2011
Catégories
En savoir plus sur Modeling dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!