MATLAB C/C++
The Language of Technical Computing
Computation
Visualization
Programming
User’s Guide
Version 2
Graphics Library
How to Contact The MathWorks:
www.mathworks.com Web
comp.soft-sys.matlab Newsgroup
support@mathworks.com Technical support
suggest@mathworks.com Product enhancement suggestions
bugs@mathworks.com Bug reports
doc@mathworks.com Documentation error reports
service@mathworks.com Order status, license renewals, passcodes
info@mathworks.com Sales, pricing, and general information
508-647-7000 Phone
508-647-7001 Fax
The MathWorks, Inc. Mail
3 Apple Hill Drive
Natick, MA 01760-2098
For contact information about worldwide offices, see the MathWorks Web site.
MATLAB C/C++ Graphics Library User’s Guide
COPYRIGHT 1999 - 2001 by The MathWorks, Inc.
The software described in this document is furnished under a license agreement. The software may be used
or copied only under the terms of the license agreement. No part of this manual may be photocopied or repro-
duced in any form without prior written consent from The MathWorks, Inc.
FEDERAL ACQUISITION: This provision applies to all acquisitions of the Program and Documentation by
or for the federal government of the United States. By accepting delivery of the Program, the government
hereby agrees that this software qualifies as "commercial" computer software within the meaning of FAR
Part 12.212, DFARS Part 227.7202-1, DFARS Part 227.7202-3, DFARS Part 252.227-7013, and DFARS Part
252.227-7014. The terms and conditions of The MathWorks, Inc. Software License Agreement shall pertain
to the government’s use and disclosure of the Program and Documentation, and shall supersede any
conflicting contractual terms or conditions. If this license fails to meet the government’s minimum needs or
is inconsistent in any respect with federal procurement law, the government agrees to return the Program
and Documentation, unused, to MathWorks.
MATLAB, Simulink, Stateflow, Handle Graphics, and Real-Time Workshop are registered trademarks, and
Target Language Compiler is a trademark of The MathWorks, Inc.
Other product or brand names are trademarks or registered trademarks of their respective holders.
Printing History: June 1999 New for Version 1.0, Release 11 (Online only)
January 2000 Revised for Version 1.0.2, Release 11 (Online only)
November 2000 First Printing Revised for Version 2.1 (Release 12)
i
Contents
Preface
Using This Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ii
Organization of the Document . . . . . . . . . . . . . . . . . . . . . . . . . . . . ii
Typographical Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . iii
Related Products . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iv
1
Introduction
Components of the MATLAB C/C++ Graphics Library . . . . 1-3
Restrictions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-6
System Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-9
Configuring the MATLAB C/C++ Graphics Library . . . . . . 1-10
Configuring the Graphics Library on PCs . . . . . . . . . . . . . . . . 1-10
Configuring the Graphics Library on UNIX Systems . . . . . . . 1-12
2
Creating Stand-Alone Graphics Applications
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3
Building a Stand-Alone Graphics Application . . . . . . . . . . . 2-5
Building Graphics Applications on a PC . . . . . . . . . . . . . . . . . . 2-5
ii Contents
Building Graphics Applications on a UNIX System . . . . . . . . . 2-7
Running the MATLAB Compiler Outside MATLAB . . . . . . . . . 2-9
Compiling and Linking Without mbuild . . . . . . . . . . . . . . . . . . . 2-9
Changes in Run-Time Behavior and Appearance . . . . . . . . 2-11
Changes to Figure Window Menu Bar Options . . . . . . . . . . . . 2-11
Changes to the Figure Window File Menu Options . . . . . . . . . 2-13
Distributing Stand-Alone Graphics Applications . . . . . . . 2-14
3
Troubleshooting
Using Unsupported MATLAB 6.0 Features . . . . . . . . . . . . . . . 3-3
Compiling Applications Written as Scripts . . . . . . . . . . . . . . 3-4
Fixing Callback Problems: Missing Functions . . . . . . . . . . . 3-6
File Menu Does Not Appear in Application . . . . . . . . . . . . . . 3-8
Depending on Graphics Settings in Start-Up Files . . . . . . . 3-9
Problem Starting Graphics Application Executable . . . . . 3-10
Preface
Using This Guide . . . . . . . . . . . . . . . . . . . ii
Expected Background . . . . . . . . . . . . . . . . . . ii
Organization of the Document . . . . . . . . . . . . . . ii
Typographical Conventions . . . . . . . . . . . . . . iii
Related Products . . . . . . . . . . . . . . . . . . . iv