MATLAB Answers

Can I use MATLAB classes in Simulink?

103 views (last 30 days)
We are trying to define some classes in separate .m files. Then we are using a instance for one of the classes in Simulink MATLAB function block to execute one of the methods of this class but we are having problems to launch it in Simulink.
We would like to know how we can use classes written in MATLAB in Simulink with the final goal of generating code.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 8 Jul 2020 at 4:00
Edited: MathWorks Support Team on 8 Jul 2020 at 12:49
You can use MATLAB classes in Simulink for code generation through MATLAB Function block.
For best practices when creating MATLAB classes for code generation:
Not all MATLAB functions are supported for code generation. Refer to this page for a list of supported functions:
In addition, this page discusses best practices for defining variables for code generation:
The MATLAB Function documentation page include links to various examples and useful articles that explains the limitations and best practices for writing MATLAB code for code generation:
These example uses MATLAB system object class in Simulink:

  0 Comments

Sign in to comment.

More Answers (0)

Tags

No tags entered yet.

Products


Release

R2017a

Translated by