Running C in Matlab
Posted: Wed Oct 05, 2016 2:59 am
- % This is MATLAB CODE with file name Hello.m
- %Print out is "Hello World"
- function Hello()
- fprintf('Hello World\n')
- end
- #include "mex.h"
- void mexFunction(int nhls, mxArray *plhs[],
- int nrhs, const mxArray *prhs[])
- {
- mexPrintf("Hello World\n");
- }
- mex -setup % Choose the compiler among the list, if not available then install.
- mex Hello.c % will run the C program