This file exchange submission contains some examples on how to include
custom C code when using MATLAB Coder, and how to support an implementation
for standard MATLAB functions not supported by MATLAB Coder. It also shows
how the build process can be more streamlined.
More information may be added here later, but for the moment, the examples must be understood by reading them.
The code in this example is described in more detail in this article: http://www.mathworks.com/company/newsletters/articles/using-legacy-code-with-matlab-coder.html?refresh=true
Anders Sollander (2021). Using Legacy Code with MATLAB Coder (https://www.mathworks.com/matlabcentral/fileexchange/51553-using-legacy-code-with-matlab-coder), MATLAB Central File Exchange. Retrieved .
Thanks for the share!
For one reason the MEX-ed my_alg-routine is slower then the original one.
tic; my_alg(1e3); toc;
Elapsed time is 0.069168 seconds.
tic; my_alg_mex(1e3); toc;
Elapsed time is 1.410066 seconds.
Is that reasonable or I'm doing something wrong?
Excellent work! May I suggest to change the last line in the script kvs_script.m to:
>codegen('-config:mex', '-I', fullfile('.', '+mlcutils'), '-o', fullfile('.', '+mlcutils', 'kvs_mex'), 'kvs', '-args', 'ARGS')
so the script will run platform independent.
Good submission. All three examples worked.
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!