Matlab System Block Initialization

I want to create a Matlab System Block from a System Object in a Simulink Model. The System Object expects an instance of a class in its constructor and assigns this instance to a property. According to the documentation this feature is not portable to the Matlab System Block because the constructor needs to be callable without any input arguments.
I would like to know how I can realize this behavior in Simulink. Where in the model do I need to create the class instance (Model Callbacks?) and how can I assign this instance to the Matlab System Block property before the simulation is started.
Here is a minimal Matlab example of what I want to recreate in Simulink:
inst_a = class_a();
inst_b = class_b();
sys_a = sysobj(inst_a);
sys_b = sysobj(inst_b);
% different behavior of stepImpl depending on the class instance given to the constructor
sys_a.step(some_input);
sys_b.step(some_input);

답변 (0개)

카테고리

도움말 센터File Exchange에서 Create System Objects에 대해 자세히 알아보기

질문:

2016년 3월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by