Sometimes we need to convert a .m extension matlab file to a executabe .exe file for various purposes.
To convert a matlab program to a executable file you have to open the program in the matlab editor.
Then in the command window write-
>>mbuild -setup
then a message will show in the command window:
Please choose your compiler for building standalone MATLAB applications:
Would you like mbuild to locate installed compilers [y]/n?
type y then command window will ask for selecting compiler....
Select a compiler:
[1] Lcc-win32 C 2.4.1 in C:\PROGRA~1\MATLAB\R2008a\sys\lcc
[2] Microsoft Visual C++ 2008 in C:\Program Files\Microsoft Visual Studio 9.0
[0] None
Compiler:
type : 1 or 2 to select one of the compiler.
then again have to verify your compiler when a message like below is shown in the window:
Please verify your choices:
Compiler: Microsoft Visual C++ 2008
Location: C:\Program Files\Microsoft Visual Studio 9.0
Are these correct [y]/n?
.....type y again.
A message will appear like below:
Trying to update options file: C:\Users\bikash\AppData\Roaming\MathWorks\MATLAB\R2008a\compopts.bat
From template: C:\PROGRA~1\MATLAB\R2008a\bin\win32\mbuildopts\msvc90compp.bat
Done . . .
Now write
>>mcc -m filename.m -o filename
if filename is guiButton then it will be >>mcc -m guiButton.m -o guiButton
then wait for a while. If >> will appear in the command window bellow the previous command line then your executable file has been created. Otherwise error will appear.
Have fun. I think this will help you a lot.
To convert a matlab program to a executable file you have to open the program in the matlab editor.
Then in the command window write-
>>mbuild -setup
then a message will show in the command window:
Please choose your compiler for building standalone MATLAB applications:
Would you like mbuild to locate installed compilers [y]/n?
type y then command window will ask for selecting compiler....
Select a compiler:
[1] Lcc-win32 C 2.4.1 in C:\PROGRA~1\MATLAB\R2008a\sys\lcc
[2] Microsoft Visual C++ 2008 in C:\Program Files\Microsoft Visual Studio 9.0
[0] None
Compiler:
type : 1 or 2 to select one of the compiler.
then again have to verify your compiler when a message like below is shown in the window:
Please verify your choices:
Compiler: Microsoft Visual C++ 2008
Location: C:\Program Files\Microsoft Visual Studio 9.0
Are these correct [y]/n?
.....type y again.
A message will appear like below:
Trying to update options file: C:\Users\bikash\AppData\Roaming\MathWorks\MATLAB\R2008a\compopts.bat
From template: C:\PROGRA~1\MATLAB\R2008a\bin\win32\mbuildopts\msvc90compp.bat
Done . . .
Now write
>>mcc -m filename.m -o filename
if filename is guiButton then it will be >>mcc -m guiButton.m -o guiButton
then wait for a while. If >> will appear in the command window bellow the previous command line then your executable file has been created. Otherwise error will appear.
Have fun. I think this will help you a lot.