Class object call as input parameter of a Matlab S-function (Level 2)
2 views (last 30 days)
Show older comments
hi, my class is defined like this : classdef class_epos properties Device_Name; ProtocolStackName; InterfaceName; PortName; Baudrate; Timeout; EposDll; EposHeader; Position; Speed; Current; end
methods
end
end
In Simulink i used the callback function InitFcn to create an instance of myclass and initialize the propoerties. The idea is to have this instance directly in the workspace,so that i can use it as input parameter of my S-function. I want the following signature of the S-function:
*s_function_name(class_epos obj)*,where obj is an instance of my class class_epos. The idea to pass the class object as input is to use the properties of the object in the S-function.
But when i do that, Simulink does not accept the object as input parameter although an instance of my class is in the workspace.
I do not understand why Simulink does not take into account that an object of my class in the workspace was already created.
For me, Simulink needs just to consider my object in the workspace and run the simulation, but it does not do that.
I don't know what i'm doing wrong.
may be someone has an idea.
1 Comment
Kaustubha Govind
on 5 Sep 2013
Parameters need to exist in the workspace even before the InitFcn runs. Is there a reason you have to wait so late to create the instance?
Answers (0)
See Also
Categories
Find more on Configure Block Features for MATLAB S-Functions in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!