Problem using emxArray_real_T from Matlab Coder
2 views (last 30 days)
Show older comments
I am trying to use C code in Arduino from Matlab Coder. It's a function that takes one argument, which is a vector size (28,n) where n is unknown. The generated C code takes 2 arguments of type emxArray_real_T, where x1 is the input vector and y1 the output vector:
void test(const emxArray_real_T *x1, emxArray_real_T *y1)
{
...
}
Now, I am trying to create the input vector, and to run the function, but I think that I have no idea how to do it. I have read examples of this but i dont understand so much.This is what I'm Trying to do:
int main
{
double values[28][1]={{2},{1},{1},{1},{1},{1},{1},{1},{1},{1},{1},{1},{1},{1},{1},{1},{1},{1},{1},{1},{1},{1},{1},{1},{1},{1},{1},{1}};
double results[5][1]={};
emxArray_real_T *inputs, *outputs;
inputs = emxCreateWrapper_real_T(values,28,1);
outputs = emxCreateWrapper_real_T(results,5,1);
test(inputs,outputs);
return 0;
}
but always I have the same compilation error:
error: cannot convert 'double (*)[1]' to 'double*' for argument '1' to 'emxArray_real_T* emxCreateWrapper_real_T(double*, int, int)'
I'm not very good with c code , if someone could explain me how to pass the input vector and obtaining the output vector would be very grateful , thank you in advance !!!
1 Comment
Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!