Can PLC Coder generate ST from "MATLAB Function"-Block that uses Classes?
조회 수: 3 (최근 30일)
이전 댓글 표시
Hello everybody,
i am trying to generate structured text from a "MATLAB Function"-Block using PLC Coder.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/165616/image.png)
Within the "MATLAB Function"-Block, i create an instance of a very simple MATLAB Class:
function y = fcn(u)
%#codegen
test = PLCtest();
y = test.a + u;
The used class "PLCtest" is defined as follows:
classdef PLCtest
properties
a = 5;
end
methods
end
end
When i try to generate ST from the "MATLAB Function"-Block with PLC Coder, i get the error:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/165618/image.png)
Is there a way to include Classes for PLC code generation? I have MATLAB 2016a and Simulink PLC Coder 2.1.
댓글 수: 0
답변 (1개)
Sri Kapali
2021년 2월 22일
편집: Sri Kapali
2021년 2월 22일
Hello,
My understanding is that you would like to generate code for MATLAB class definitions using Simulink PLC Coder. Simulink PLC Coder currently does not support MATLAB classes for code generation. You could try converting you class definition to a Simulink.Parameter or Simulink.Enum type object to generate structured text code for the same.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Simulink PLC Coder에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!