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!