This example shows how to call a C shared library built with MATLAB® Compiler SDK™ from a C application.
Create the C shared library mentioned in the example see Create a C Shared Library with MATLAB Code.
matrix.c file in
Copy and paste this file in the
for_testing folder created when you
generated the C shared library.
Use the system command line to navigate to the
To compile and link the application, use
mbuild at the system
mbuild matrix.c libmatrix.lib
.lib extension is for Windows®. On Mac, the file extension is
.dylib, and on UNIX® it is
From the system command prompt, run the application.
matrixThe sum of the matrix with itself is: 2.00 8.00 14.00 4.00 10.00 16.00 6.00 12.00 18.00 The product of the matrix with itself is: 30.00 66.00 102.00 36.00 81.00 126.00 42.00 96.00 150.00 The eigenvalues of the original matrix are: 16.12 -1.12 -0.00