Unformatted text preview:

Extending MATLABUsing MATLABSlide 3WhySlide 5External MATLABSlide 7Slide 8Slide 9Slide 10Standalone MATLAB ApplicationUsing MATLAB CompilerSetting Up MATLAB CompilerSlide 14Slide 15Creating the MCRSlide 17Deploying the ApplicationMATLAB Application ExampleSlide 20Slide 21Slide 22Slide 23Slide 24Slide 25Slide 26Slide 27Slide 28Slide 29Slide 30Slide 31Slide 32Slide 33Slide 34Slide 35Slide 36MATLAB Excel ComponentSlide 38MATLAB Excel InteractionSlide 40Slide 41MATLAB Builder for JavaSlide 43MATLAB Java InteractionAdd External Function to MATLABSlide 46AE6382Extending MATLABAE6382Using MATLAB•MATLAB can be used as a mathematical scripting language (.m files)•Stand-alone MATLAB applications–MATLAB code can be converted to a stand-alone form •requires a MATLAB Compiler toolbox license to compile•no license required for the stand-alone file•Extending MATLAB–MATLAB can access shared libraries written in C/C++ and Fortran in both Windows (DLL) and Unix/Linux–MATLAB can access functions written in C/C++ and Fortran as MATLAB functions, the so-called MEX files–MATLAB and Java have a very close relationship•MATLAB can use Java classes•MATLAB and Java can exchange data using Java classesAE6382Using MATLAB•Accessing MATLAB from other programs–C/C++ and Fortran programs can access MATLAB•Using the MATLAB Engine API (Windows and Unix/Linux)•Using COM functions in Windows–As an extension of the Standalone Application, a C/C++/Fortran callable library that encapsulates a set of m-files can be built–MATLAB and Excel can inter-operate (Excel can use MATLAB objects)•Data Exchange applications–C/C++ and Fortran can read and write MAT-files - files that contain native MATLAB data–MATLAB is able to read and write data in a variety of other formatsAE6382Why•You can create a standalone application based on MATLAB that can be freely distributed – no license required to run it•You have a complex application written in C/C++/Fortran that you would like to access from within MATLAB. Compile and link as a MATLAB function.•You need to load a large data set into MATLAB. Use either the native text input functions of MATLAB or use MAT-Files. This will require C/C++ or Fortran programming. The COM interface can also be used when using Windows.•You have an m-function that you would like to use in Excel. The MATLAB Excel Builder will create a COM object that can be used from Excel. This capability is similar to the MATLAB Compiler functionality.AE6382Why•You would like to make use of some feature that MATLAB provides in a program that you currently have or are developing. The MATLAB Engine API can be used for this purpose. It allows the control of MATLAB from another process. This API is intended for C/C++ and Fortran programmers, however, the COM Automation interface can be used on Windows from a script. There are also add-on modules for Python and Perl that provide Engine access from those languages.•You would like to combine MATLAB with a Java program•You would like to create a Java GUI with MATLABAE6382External MATLABThe MATLAB manual that describes the Compiler toolbox that enables the creation of standalone executables for use on other systems that do have have MATLAB installed.AE6382External MATLAB•The MATLAB manual that describes the available external interfaces that are available in MATLAB.•MAT-Files•Calling external libraries•Calling C/Fortran from MATLAB–MEX files (C/C++/Fortran)•Calling MATLAB from C/Fortran–Matlab Engine•Calling Java from MATLAB•COM interfaces in MATLAB (Windows)•Web ServicesAE6382External MATLABThe MATLAB manual that describes the interface designed for Excel. It turns M functions into COM objects that can be accessed from with Excel using VBA.AE6382External MATLABThe MATLAB manual that describes the interface to Java. It converts MATLAB m-functions into Java classes that can be used from within a Java program.AE6382External MATLABThe MATLAB manual that describes the API functions that can be used by C/C++ and Fortran programs to interact with MATLAB.•MAT-File •MX Array Manipulation•MEX-Files•MATLAB EngineAE6382Standalone MATLAB Application•Use MATLAB Compiler to generate a standalone application, library, or component•Requires the Compiler toolbox be licensed and installed on your system•Requires that an MCR (MATLAB Component Runtime) file be installed on the target system•Applications created using the MATLAB compiler are versions specific and require the correct MCR file, it must match the MATLAB version used to create the applicationAE6382Using MATLAB Compiler•Use the MATLAB compiler to include the user supplied m-files in the CTF file•Create a wrapper C file and compile into an executable program•Terms–CTF is the Component Technology File•this is an encrypted copy of your m-files and all dependencies (toolbox, …)•once created it cannot be modified•contains a copy of your preferences files–MCR is the MATLAB Component Runtime•this is a complete set of MATLAB runtime libraries that enables the application to run•supplied by MATLAB, usually ~200MB in size–application executable•this is the compiled wrapper code generated by MATLAB•it contains the encryption keys that allow the CTF file to executeAE6382Setting Up MATLAB Compiler•Before you can create your application the MATLAB compiler must be configured – only required once per installation•Determine what C/C++ compilers exist on your system•Windows – supported compilers–Lcc C is the built-in C compiler–Microsoft Visual C/C++ (MSVC) Versions 6.0, 7.1, and 8.0•Linux – supported compilers–gcc and g++•Setup environment–mbuild –setup–for Windows execute from a cmd.exe window–creates the options file that is used by the mcc commandAE6382Setting Up MATLAB Compiler•mbuild on Linux R2007B[matlab2007b]$ bin/mbuild -setup Options files control which compiler to use, the compiler and link command options, and the runtime libraries to link against. Using the 'mbuild -setup' command selects an options file that is placed in ~/.matlab/R2007b and used by default for 'mbuild'. An options file in the current working directory or specified on the command line overrides the default options file in ~/.matlab/R2007b. To override the default options file, use the 'mbuild -f' command (see 'mbuild -help' for more information).The options files available for mbuild


View Full Document

GT AE 6382 - Extending MATLAB

Download Extending MATLAB
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Extending MATLAB and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Extending MATLAB 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?