How to integrate a matlab class in a simulink block?

3 次查看(过去 30 天)
Hello everyone,
In Matlab 2013a, I developed a matlab class named as MyUnitDelay, it has properties "IC,u,y" and methods "initialize,step,update".
classdef MyUnitDelay < handle
properties
IC; %initial condition
u; %input port
y; %output port
end
methods
function initialize(obj,ic)
obj.IC = ic;
obj.u = 0;
obj.y = 0;
end
function y = step(obj,u)
obj.u = u;
obj.y = obj.IC;
y = obj.IC;
end
function obj = update(obj)
obj.IC = obj.u;
end
end
end
I want to create a special Simulink block in which I can create an instance of that class and call appropriate method according to simulation phase.
In this manner;
  • What is the most appropriate Simulink block? Level-2 Matlab SFunction/Matlab Function/anything else?I can not use "Matlab System" block since Matlab 2013a version does not support that block.
  • Should i derive the class from another superclass according to the block selection? If yes, what should be the superclass?
  • I need to generate code from that model. Therefore i need a Simulink block which is supported by Simulink Coder.

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Manual Performance Optimization 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by