ensure Matlab Compiler is installed on compiling PC:
Install the Matlab Compiler Runtime on running PC
Now we write a test program by saving the following test into a file called mymcc.m
function Y = mymcc X = 0:0.01:2*3.14; Y = sin(X); plot(X,Y) title('Test of MCR') xlabel('x') ylabel('y') disp('wow I ran an MCR program!') end
Then type in Matlab console:
mcc -m -v mymcc.m
creating files: readme.txt, mymcc, run_mymcc.sh
and you’ll see:
wow I ran an MCR program!
along with a typical Matlab plot window showing a sine wave. Just close the plot window to end the execution of your program.
The Matlab Compiler allows you to compile your existing .m Matlab script to run as an executable on another PC without Matlab. Note that this is NOT in general a way to speedup your Matlab code execution.
See the readme.txt created with the mcc command above.