Generating C code from MATLAB code and the Art of Speeding up MATLAB Applications.
To generate C code from Matlab code is not as simple as it looks. MATLAB code does not map directly to c code, so it’s necessary to modify the code before transforming it to a C library.
Therefore there is a lot of rewriting the MATLAB code before transforming it to a C standalone library. For that it’s necessary to:
– Initialize each variable before its used by specifying its size and data type.
In the case that the variable needs to vary its size during execution, then you have 3 options:
1. Static allocation with fixed maximum size
2. Variable sizing with maximum size allocation.
3. Variable sizing with dynamic memory allocation.
In any case, this seems like a troublesome experience. For a more detailed description on how to do this, take a look here.
If the reason why you wanna generate C code from MATLAB code is that you want to speed up your application, take a look here.