[ Pobierz całość w formacie PDF ]

MATLAB Compiler s Graphics Library Bundle Files on PCs
\toolbox\compiler\bundles\sgl
C applications
\toolbox\compiler\bundles\sglcpp
C++ applications
For example, to convert the Lorenz application into a stand-alone application,
enter these commands at the MATLAB prompt.
mbuild -setup
!copy \toolbox\matlab\demos\lorenz.m .
mcc -B sgl lorenz.m
!lorenz
2-5
Building a Stand-Alone Graphics Application
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 Graphics Applications on a UNIX System
To create a stand-alone graphics application on a UNIX system, 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 UNIX Systems
/toolbox/compiler/bundles/sgl
C applications
/toolbox/compiler/bundles/sglcpp
C++ applications
For example, to convert the Lorenz application into a stand-alone application,
enter these commands at the MATLAB prompt.
mbuild -setup
!cp /toolbox/matlab/demos/lorenz.m ./
mcc -B sgl lorenz.m
!lorenz
Note the following:
" The example uses mbuild -setup to set up the environment to create
stand-alone applications. This is only required the first time you create a
stand-alone graphics application. See  Configuring the MATLAB C/C++
Graphics Library on page 1-10 for more information about mbuild.
2-7
2 Creating Stand-Alone Graphics Applications
" The example uses the UNIX cp command to copy the Lorenz application
M-file into the current MATLAB directory. Use the ! symbol to execute an
operating system command inside the MATLAB environment. (This is
suggested because you may not have permission to create a new file in the
MATLAB demos directory.) Replace with the name of your top-level
MATLAB installation directory.
" The example invokes the MATLAB Compiler, using the -B flag to specify the
bundle used to create C stand-alone graphics applications, sgl
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 applicationsuch 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 on page 2-11.) Subsequently, when 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. You can run your stand-alone graphics application at the MATLAB
prompt if you precede the executable name with a !, as shown in the example.
You can also run a stand-alone application outside of the MATLAB
environment. However, you must add to your path the location of the shared
libraries to which your application is linked.To set your path, use the
command from this table that is specific for your system.
2-8
Building a Stand-Alone Graphics Application
Architecture Command
setenv SHLIB_PATH /extern/lib/hp700:/bin/
HP700
hp700:$SHLIB_PATH
setenv LD_LIBRARY_PATH /extern/lib/:/bin/
All others
:$LD_LIBRARY_PATH
where:
is the MATLAB root directory.
is your system architecture
To avoid having to reissue this command at the start of each login session,
include it in a startup script such as ~/.cshrc or ~/.login. Use the ~/.login
option, if your system supports it, because it only gets executed once.
Running the MATLAB Compiler Outside MATLAB
You can run the MATLAB Compiler outside the MATLAB environment,
invoking it at the system prompt. If you do, you must use the -I option on the
Compiler command line to specify the locations of the M-files that your
application depends on.For example, the Lorenz application uses functions in
the graph2d, graphics, demos, and graph3d subdirectories of the [ Pobierz całość w formacie PDF ]

  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • ewagotuje.htw.pl
  • Copyright © 2016 WiedziaÅ‚a, że to nieÅ‚adnie tak nienawidzić rodziców, ale nie mogÅ‚a siÄ™ powstrzymać.
    Design: Solitaire