MATLAB C/C++ Graphics Library    

Building Graphics Applications on a PC

To create a stand-alone graphics application on a PC, you must use the MATLAB Compiler (mcc), specifying the Compiler's Graphics Library bundle file.

Bundle files are ASCII text files that contain Compiler command line options and arguments. The MATLAB Compiler supports separate bundle files for creating C stand-alone graphics applications and C++ applications.

MATLAB Compiler's Graphics Library Bundle Files on PCs
C applications
<MATLAB>\toolbox\compiler\bundles\sgl
C++ applications
<MATLAB>\toolbox\compiler\bundles\sglcpp

For example, to convert the Lorenz application into a stand-alone application, enter these commands at the MATLAB prompt.

Note the following:

Results of Compilation

The MATLAB Compiler generates multiple C or C++ source code modules in your current working directory. These include wrapper files that contain necessary components of a stand-alone application, such as a main() entry point.

In addition, the first time you run the MATLAB Compiler to create a stand-alone graphics application, it creates a subdirectory, named \bin, in your current working directory. The Compiler puts in this directory versions of the MATLAB menu bar and toolbar figure files that are used by stand-alone graphics applications at run-time. (Stand-alone graphics applications use a special menu bar and toolbar. For more information, see Changes in Run-Time Behavior and Appearance.) Subsequently, whenever you run the Compiler, it checks for the existence of these files in the \bin directory and does not overwrite them if they exist.

Running a Stand-Alone Graphics Application

The Compiler creates the stand-alone graphics application as an executable program in your current working directory, giving it the same name as your M-file, but with the .exe filename extension. You can run the application at the MATLAB command prompt if you precede the name with a ! symbol, as shown in the example. You can also run stand-alone graphics applications outside the MATLAB environment. However, make sure that the directory containing the shared libraries to which your application has been linked (<MATLAB>\bin) is on your directory search path.

Editing the Search Path on Windows 95.   On Window 95 systems, you must edit your autoexec.bat file to add the shared library directory to the PATH variable.

Editing the Search Path on Windows NT.   On Windows NT systems, go the Settings option on the Start menu and choose Control Panel. Double-click on the System icon to view the System Properties dialog box. Use the Environment panel to edit the PATH variable.


 Building a Stand-Alone Graphics Application Building Graphics Applications on a UNIX System