Use custom data types for code replacement library in MATLAB - Simulink Code Replacement Library

99 Views Asked by At

I want to use a custom data type for a code replacement entry in MATLAB - Simulink.

I have a C function whose arguments are expected to be in a custom data type defined previously in the same header file. C Function:

my_func(const my_type_def* matA_in, const my_type_def* matB_in, my_type_def* mat_out)

Type definition (in the same .h):

typedef struct
{
    uint16_t numRows;
    uint16_t numCols;
    double* mdata;
} my_type_def;

As you may notice, I want to replace all matrix multiplications (in the form A*B) with my custom C code. I configure the entry for the Code Replacement Library (CRL) for the conceptual implementation and the specification implementation, respectively, in the following way:

'my_type_def* y1 = mtimes( const my_type_def* u1, const my_type_def* u2  )', ...
    'my_func( const my_type_def* u1, const my_type_def* u2, my_type_def* y1 )');

The error I get with this is:

Missing data type for argument 'my_type_def'

I tried desperately to look online for documentation or a way around to do this but unfortunately I was not able to find a solution, it seems the only accepted data types for CRL entries are double, single, int, etc, etc. Any help at all is very welcome ! (I'm not an expert in this topic) Thank you very much in advance.

0

There are 0 best solutions below