(Note: The MATLAB coding described in this appendix has been tested on a Windows 7 computer. The equivalent system calls should work on a Unix or Mac computer, but have not been tested.)
Sometimes it is desirable to perform some calculations in a language other than MATLAB. Possible reasons for this are that (1) a complicated, working, calculation program already exists; or (2) it is difficult or even impossible to vectorize a MATLAB program but desirable to utilize the calculation speed of some fully compiled optimized code in a language such as C or FORTRAN.
MATLAB has built-in capabilities for doing this.1,2 The MATLAB capabilities are significant and merit investigation if this type of interface is desired. There are limitations, however, as to what compilers and languages are supported. The technique described in this appendix is a “quick and dirty” patch that works well provided you can write or modify and compile code with a compiler and language of your choice into an executable program.
The procedure is very straightforward and utilizes MATLAB's capability of executing a system command and then waiting for its completion: