I use a lot of matlab to process data etc. Yet I find my workflow a bit of sluggish, so I was wondering if I could speed things up a little using makefiles.

What I would like to do is write an .m file which, when called, creates a file with all of my data output, so that I can use the data in other programs. I would like to add a line to my makefile then:

output.dat: input.dat process1.m process2.m
        $MATLABROOT/matlab -nodesktop -nosplash -r 'var1=process1;process2(var1);quit()'

yet it seems to me there base to be a better way. The problem here is that it takes a long while for matlab to start up, and it has to be started every time output.dat is regenerated (even when my actual matlab code didn't change).

Is there a way to easily get some sort of compiled matlab form of the .m files? Like one would have with a c++ file?

1 Answer 1


MATLAB Compiler

mcc is the MATLAB command that invokes MATLAB Compiler. You can issue the mcc command either from the MATLAB command prompt (MATLAB mode) or the DOS or UNIX command line (standalone mode).

mcc prepares MATLAB file(s) for deployment outside of the MATLAB environment, generates wrapper files in C or C++, optionally builds standalone binary files, and writes any resulting files into the current folder, by default.

  • Could you please explain what this is and how it helps, instead of just dumping a link?
    – nhinkle
    Dec 7, 2011 at 1:41
  • 1
    @nhinkle: TBH, I was planning on just dumping a comment.
    – Hello71
    Dec 8, 2011 at 2:26
  • gareth's edits made it much better, as an example of how you can turn a mere link into a decent answer.
    – nhinkle
    Dec 8, 2011 at 2:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.