How to specify class method to compile to codegen

조회 수: 8 (최근 30일)
Anze Slosar
Anze Slosar 2022년 12월 2일
답변: Raghu Boggavarapu 2023년 9월 28일
I need to use matlab to compile some VHDL code. I need to use several instances of the same functional block. The only way to have several instances of a function with "persistent" is to use classes. I made a class that inherits handle and does what it should do.
Now I would like to compile it with codegen. I would like to use something like
codegen -float2fixed fixptcfg -config hdlcfg -args {int16(0),0,0,0,0} weight_fold.process
where weight_fold is a class name and process is the method inside the class that I would like to compile. How do I do this? If I don't specify .process it complains that weight_fold is a class. If I do as above it also does not like it. The matlab documentation states that while it is not possible to compile classes that it is possible to compile individual class method. How do I specify it?

답변 (2개)

Nithin Kumar
Nithin Kumar 2023년 9월 6일
편집: Nithin Kumar 2023년 9월 6일
Hi Anze,
I understand that you are facing an issue while trying to compile the specific method of a class using "codegen".
In the "codegen" command that you have provided, I observed that you have mentioned the arguments before the method of a class you want to generate code for. I recommend you use the class and method first and then arguments as shown in the following code snippet -
codegen -float2fixed fixptcfg -config hdlcfg weight_fold.process -args{int16(0),0,0,0}
For more information regarding "codegen", Kindly refer to the following documentation:
I hope this provides you with the required information regarding your query.
Regards,
Nithin Kumar.

Raghu Boggavarapu
Raghu Boggavarapu 2023년 9월 28일
MATLAB Coder does support classes in code generation. However they are not supported as entrypoints for code generation.
To be able to generate the code for class methods, please use the class as part of normal MATLAB function and generate the code for MATLAB function.

카테고리

Help CenterFile Exchange에서 MATLAB Coder에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by