GETTING STARTED WITH MATLAB COMPILER
When you using your MATLAB programs such as GUI related things its bit messy to run MATLAB and then to run your MATLAB scripts since MATLAB takes some time to run and it uses more resources from your computer. So it’s very easy if we can run our MATLAB applications without running MATLAB. The MATLAB compiler gives us the opportunity which to convert our m-scripts to exe files. In this article I’ll try to share my experiences on configuring MATLAB compiler and to deploy a MATLAB script to an *.exe file.
CONFIGURING MATLAB COMPILER
Make sure you got installed ANSI C or C++ Compiler in your computer. First type ‘mbuild -setup’ on your MATLAB command prompt.
Press ‘y’ and Enter to continue on operation (Pressing <ENTER> is also sufficient since the default answer is [y].) Then MATLAB will list down all the compilers you have installed in your computer and prompt you to select a compiler to use.
I choose ‘Microsoft Visual C++ 2008 SP1 in C:\Program Files\Microsoft Visual Studio 9.0’ as my compiler, so I enter ‘2’.
After selecting the compiler MATLAB asks to verify it and to confirm. To continue, press <ENTER>. Now you are done with configuring MATLAB compiler on your computer.
Next lets see how to deploy m-scripts to *.exe and to make packaging for m-scripts.
DEPLOY M-SCRIPT ON MATLAB COMPILER
For the deployment I use the files I programmed for my previous article on MATLAB GUI programming. To select the deployment tool you can either select deployment tool by ‘Desktop’ tab in MATLAB (Desktop>>Deployment tool) or By File>>New>>Deployment project.
When you select new deployment project ‘Deployment Project’ Window will be opened and prompt you to set file location and project name as follows. I select the target result as Stand-alone application, but you can select whatever you want from the drop down menu. Then click <OK> to continue.
Lets first look how to build the project on MATLAB and then to package the project. Go to the build tab on Deployment tool and click add main file link to add your entry point to the program. This is the m-file which you run to start your MATLAB application. For my application main m-file is ‘paint_effect_gui.m’. And then click on ‘add files/directories’ link to add other related files to the project.
Then finally click on built icon to build your project. It will take some time to build your project, you can see the pop-up window which shows the build log as below.
Your project fill be now saved in the ‘proect location/project_name/distrib’.
For package the project click on the package icon and it will package your project. Note that the second icon is the package button.
In-order to start new deployment project or to set other options click on actions icon.
Thank you very much for reading.