Changes to referenced model model workspace in project converted to older version

조회 수: 3 (최근 30일)
I wrote a Simulink library containing referenced models (Matlab R2021a) and then exported it to an older version (R2020b) using
Simulink.exportToVersion(myProject,'project_older_version','R2020b')
but wasn't able to run my models (on R2020b). I tracked it down to a difference between the model parameters for the blocks that I reference.
For example, one of the blocks in the original (R2021a) model has a double, [1 1], parameter. This screenshot is from the model explorer opened in the model (.slx file) that is being referenced by the library. R2021a release opening the R2021a file.
R2021a release opening the R2020b-converted file:
R2020b release opening the R2020b-converted file.
the parameter is now [0 0] and errors arise when I try to run.
Weirdly, I think get_param and set_param still works (???). In the CLI (of R2020b running the R2020b-converted file)
>> get_param(sensor, 'sensorGain')
ans =
'0.94507'
>> set_param(sensor, 'sensorGain', '2')
>> get_param(sensor, 'sensorGain')
ans =
'2'
But the error when I try to run (R2020b running the R2020b-converted file)
>> mdlOutput = sim(mdl,'StartTime','0','StopTime',num2str(stopTime));
Error using testscript_toygrace (line 32)
Block diagram 'sensParaPlates1v1' has a parameter argument 'sensorGain' but the corresponding parameter in the model's workspace is not valid. The value of this parameter must be
numeric and non-empty.
The 2021a run it just fine.
I saw that the Simulink.exportToVersion documentation mentions a breakUserLinks option when exporting a model, but I don't understand what does it do and how it applies when exporting an entire project.
...
So, why does this happen? And how to export so the older version of Simulink will have the correct model workspace?

답변 (0개)

카테고리

Help CenterFile Exchange에서 Simulink Functions에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by