Simulink: Model referencing of MATLAB System. Parameters not set in setupImpl
3 ビュー (過去 30 日間)
古いコメントを表示
Hi everyone,
I have some issues in initialization of a MATLAB System block with interpreted execution. My model hierachy looks like this:
ParentModel
|-ModelRefA
|-ModelRefB
|-MyLibWithMATLABSystem
All models are parameterized with model arguments and assigned as arguments to each system propagated from the ParentModel. That works fine and also in my library (MyLibWithMATLABSystem) I get the proper parameters.
My MATLAB System looks like:
% ...
properties
MyProp = getDefaultPropValue();
end
% ....
function setupImpl(obj)
test = obj.MyProp; % <-- always shows default parameter but not model argument parameter
% Some other code for initialization, relying on MyProp
end
I assign different values for MyProp as model arguments/mask parameters.
When I test MyLibWithMATLABSystem in a test model everything is working, also when running ModelRefB with loaded parameters in the model workspace. When I use it as a referenced model, I only get the defaults for MyProp.
My guess is, that the initializiation takes place before the model parameters are passed to each submodel.
How to solve that problem or where do I have my logical error?
Thanks for your help!
0 件のコメント
回答 (1 件)
Ludo Houben
2024 年 1 月 3 日
Hi
I have the same 'challenge'. I would like to use a loaded struct for the parameterization of a function, but it is vital that the info is already present when the block is created. I'm still finding the real solution but maybe my workaround also works for you:
Regards
Ludo
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!