File Exchange

image thumbnail

Using Legacy Code with MATLAB Coder

version 1.1.0.1 (7.87 KB) by

Some examples on building MATLAB code with existing C code

2 Downloads

Updated

View License

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

Comments and Ratings (3)

Michael

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?

Stefano Gianoli

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.

Matthew

Good submission. All three examples worked.

Updates

1.1.0.1

Updated license

1.1

Added link to article.

1.0

Added some code anylsis relevant comments in some files.

MATLAB Release
MATLAB 8.5 (R2015a)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video