Why does my mpt.parameter not evaluate correctly in an IF-ELSE block when its datatype is anything other than a double or single in Real-Time Workshop 5.3 (R2009a)?

1 view (last 30 days)
I have a model that contains an IF-ELSE Simulink block. For the logical comparison in the dialog parameter of this block I am using an mpt.parameter data object that is part of the MPT package in Real-Time Workshop Embedded Coder. I define this mpt.parameter to be of type uint16 (or any non-double, non-single) data type. When I try to update diagram or press play, I get the following error:
ERROR: The expression 'u1 > Test' in 'TestIfBlockWithMPT/If' has a syntax error.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 23 Feb 2022
Edited: MathWorks Support Team on 23 Feb 2022
This is expected behavior in Real-Time Workshop 5.3 (R2009a) due to the evaluation order of the mpt.parameter at the model initialization callback. You may not evaluate variables such as uint8(5) in the IF/ELSE Simulink block as outlined in the documentation here;
To correctly evaluate the mpt.parameter object, use it in a Compare to block that feeds the IF-ELSE block and do not use a mpt.parameter in the IF-ELSE block.
See the attached original and modified models.

More Answers (0)

Categories

Find more on Deployment, Integration, and Supported Hardware in Help Center and File Exchange

Products


Release

R2009b

Community Treasure Hunt

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

Start Hunting!