필터 지우기
필터 지우기

How to set output type manually in matlab coder

조회 수: 6 (최근 30일)
Alireza Tabatabaee
Alireza Tabatabaee 2022년 4월 12일
답변: Denis Gurchenkov 2022년 4월 13일
When I turn a simple matlab function that looks like y = wdn(x) into C code with matlab coder, the resulting C function looks like this:
void wdn(const float x[15400], emxArray_real_T *y)
How can I set y's type as float* ? I don't want to use emxArray_real_T because it is causing me problems when I try to use the code on a microcontroller.
I read somewhere that these structures are for dynamic memory allocation, however turning off dynamic memory allocation in matlab coder's settings did not help.

답변 (1개)

Denis Gurchenkov
Denis Gurchenkov 2022년 4월 13일
Hi Alireza,
The "emxArray_real_T" type indicates that the code generator does not know what is the maximum number of elements in "y". That is, it thinks that the number of elements in y may change from run to run, and it could not figure out an upper bound for it.
You could help the code generator to understand that y is bounded by using one of the techniques here:
If that does not help, maybe can attach the example you have (and the command line arguments you use) so that someone could take a closer look.
You also mentioned that the emxarray type creates an issue on the microcontroller. Why is so? That type is just a plain C struct type, and there is a header file that defines it, all you need to do is to make that header file available to your C compiler.

카테고리

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

태그

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by