MATLAB APPLICATION DEPLOYMENT - WEB EXAMPLE GUIDE Betriebsanweisung

Stöbern Sie online oder laden Sie Betriebsanweisung nach Software MATLAB APPLICATION DEPLOYMENT - WEB EXAMPLE GUIDE herunter. MATLAB APPLICATION DEPLOYMENT - WEB EXAMPLE GUIDE User`s guide [en] Benutzerhandbuch

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 354
  • Inhaltsverzeichnis
  • FEHLERBEHEBUNG
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen

Inhaltsverzeichnis

Seite 1 - User’s Guide

MATLAB®Compiler 4User’s Guide

Seite 2 - Natick, MA 01760-2098

C Shared Library Target ... 7-4C Shared Library Wrapper... 7-4C Shared Library Example...

Seite 3 - Revision History

5 Compiler CommandsRunning this script M-file from a MATLAB session creates variables m and tin your MATLAB w orkspace browser.MATLAB Compiler cannot

Seite 4

Script Filesfunction houdini_fcnhoudini;To produce the houdini_fcn , which will call the houdini.m script M-file, u semcc -m houdini_fcn5-21

Seite 5

5 Compiler CommandsCompiler TipsIn this section...“Calling B uilt-In Functions from C or C ++” on page 5-22“Calling a Function from the Comm and Line”

Seite 6

Compiler Tipsm = magic(n);Calling a Function from the Command LineYou can make a MATLAB function into a standalone that is directly callablefrom the s

Seite 7

5 Compiler Commands..\myProgram.exeyou may see the error:Cannot find the directory containing the 'myProgram' compon ent,which is required b

Seite 8

Compiler TipsDeploying Applications That Call the Java NativeLibrariesIf your application interacts with Java, you need to specify the search path for

Seite 9

5 Compiler Commands• There are one or more figures y ou want to remain open.• The function that displays the graphics requires user input beforecontin

Seite 10 - Troubleshooting

Compiler TipsPassing Arguments to and from a StandaloneApplicationTo pass input arguments to a MATLAB C ompiler generated standaloneapplication, you p

Seite 11 - Reference Information

5 Compiler Commands• You cannot return back values from your standalone application to the user.The only way to return values from compiled code is to

Seite 12

6Standalone ApplicationsThis chapter describes how to use MATLAB Compiler to code and buildstandalone applications. You can distribute standalone appl

Seite 13 - C++ Utility Library Reference

Reference Information9Directories Required for D eve lopme nt and Testing ... 9-2Overview... 9-2Path for Java Dev

Seite 14 - Contents

6 Standalone ApplicationsIntroductionSuppose you want to create an application that calculates the rank of alargemagicsquare. Onewaytocreatethisapplic

Seite 15 - Getting Started

C Standalone App lication TargetC Standalone Application TargetIn this section...“Compiling the A pplication” on page 6-3“Testing the Application” on

Seite 16 - What Is MATLAB Compiler?

6 Standalone ApplicationsNote Testing your application on your development machine is an importantstep to help ensure that your application is compila

Seite 17 - Wrapper Files

C Standalone App lication Targetmatlabroot/sys/java/jre/sol64/jre1.6.0/lib/sparcv9/native_threads:matlabroot/sys/java/jre/sol64/jre1.6.0/lib/sparcv9/s

Seite 18 - 1 Getting Star ted

6 Standalone ApplicationsThe results are displayed asans =16231351110 89761241415 1Deploying the ApplicationYo u can distribute a MATLAB Compiler gene

Seite 19 - Before You Begin

C Standalone App lication TargetUNIXDistribute and package your standalone application on UNIX by packagingthe following files and distributing them t

Seite 20 - Component

6 Standalone ApplicationsNote On Windows XP, this directory is automatically adde d to your p ath.Preparing UNIX Machines1 Install the MCR by unzippin

Seite 21 - Magic Square Example

C Standalone App lication Targetsetenv LD_LIBRARY_PATH/usr/lib/lwp:<mcr_root>/<ver>/run time/sol64:<mcr_root>/<ver>/sys/os/sol

Seite 22

6 Standalone ApplicationsCaution There is a limitation regarding directories on your path. If thetarget machine has a MATLAB installation, the<mcr_

Seite 23 - .zip file

Coding with M-Files OnlyCoding with M-Files OnlyIn this section...“M-File Advantages” on page 6-11“Example” on page 6-11M-File AdvantagesOne way to cr

Seite 24 - Using the mcc Command

Functions — Alphabetical List11Limitations and Restrictions12Limitations About What May Be Compiled ... 12-2Compiling MATLAB and Toolboxes...

Seite 25

6 Standalone Applicationsfunction mainr = mrank(5)Compiling the ExampleTo compile these functions into code that can be built into a standaloneapplica

Seite 26

Mixing M-Files and C or C++Mixing M-Files and C or C++In this section...“Examples Overvie w” on page 6-13“Simple Example” on page 6-13“Advanced C Exam

Seite 27

6 Standalone Applicationsmrank.mmrank.m contains a function that returns a vector of the ranks of the magicsquares from 1 to n.function r = mrank(n)r

Seite 28

Mixing M-Files and C or C++MATLAB Compiler generates the following C source code files:•libPkg.c• libPkg.h• libPkg_mcc_component_data.c6-15

Seite 29 - For M ore Information

6 Standalone ApplicationsThis command invokes mbuild to compile the resulting MATLAB Compilergenerated source files with the existing C source files (

Seite 30

Mixing M-Files and C or C++}mclInitializeApplication(NULL,0);libPkgInitialize();/* Initialize library of M-Functions *//* Create a 1-by-1 matrix conta

Seite 31 - Configuration

6 Standalone ApplicationsTo create and manipulate mxArray * variables in your C code, you can call themx routines described in the External Interfaces

Seite 32 - Requirements

Mixing M-Files and C or C++• main_for_lib.c, which contains one main function•main_for_lib.h, which is the header for structures used inmain_for_lib.c

Seite 33

6 Standalone Applications/* Initialize with a print handler to tell mlfPrintMatrix* how to display its output.*/mclInitializeApplication(NULL,0);libMu

Seite 34 - Installation

Mixing M-Files and C or C++The program first displays the contents of a 3-by-3 matrix a,andthendisplaysthe contents of scalarb.6.2832 +34.5575i 25.132

Seite 35

Compile-Time Errors ... B-3Warning Messages... B-7depfun Errors...

Seite 36 - VC98 directory from

6 Standalone Applications6-22

Seite 37

7LibrariesThis chapter describes h ow to use MATLAB Compiler to create libraries.Introduction (p. 7-2)Overview of shared librariesAddressing mwArrays

Seite 38

7 LibrariesIntroductionYo u can use MATLAB Compiler to create C or C++ shared libraries (DLLson Windows) from your MATLAB a lgorithms. You can then wr

Seite 39

Addressing mwArrays Above the 2 GB LimitAddressing mwArrays Above the 2 GB LimitAs of R2007b, you can now address mwArrays above the 2 GB limit on 64-

Seite 40

7 LibrariesC Shared Library TargetIn this section...“C Shared Library W rapper” on page 7-4“C Shared Library Example” on page 7-4“Calling a Shared Lib

Seite 41

C Shared Library Targetmatlabroot/extern/examples/compiler/multiplymatrix. mmatlabroot/extern/examples/compiler/eigmatrix.mmatlabroot/extern/examples/

Seite 42 - Options Files

7 LibrariesNote If your driver application displays MATLAB figure windows, youshould include a ca ll tomclWaitForFiguresToDie(NULL) before callingtheT

Seite 43 - Changing the Options File

C Shared Library TargetNote This command assumes that the shared library and the correspondingheader file created from step 2 are in the current worki

Seite 44

7 LibrariesNote Testing your application on your development machine is an importantstep to help ensure that your application is compilable. To verify

Seite 45 - Compilation Process

C Shared Library TargetCreating Shared Libraries from C with mbuildmbuild can also create shared libraries from C source code. If a file withthe exten

Seite 46 - 3 Compilation Process

mwArray Class Functions ... C-33Indexxiv Contents

Seite 47 - Build Process

7 LibrariesComponent Descriptionlibmatrix.ctfComponent Technology File archive;platform-dependent file that must correspondto the end user’s platform.

Seite 48

C Shared Library TargetComponent Descriptionlibmatrix.ctfComponent Technology File archive;platform-dependent file that must correspond tothe end user

Seite 49 - C/C++ Compilation

7 LibrariesCaution You m us t call mclIni tializeApplication once at the beginningof your driver application. You must make this call before calling a

Seite 50 - Input and Output Files

C Shared Library Targetif (!libmatrixInitial ize( )){fprintf(stderr,"could not initialize the libraryproperly\n");return -1;}/* Create the i

Seite 51 - CSharedLibrary

7 LibrariesCaution mclInitializeApplication can only b e called once perapplicatio n . Calling it a second time generates an error, and will cau se th

Seite 52

C Shared Library TargetNote On Windows, if you want to have your shared library call aMATLAB shared library (as generated by MATLAB Compiler), theMATL

Seite 53 - C++ Shared Libra

7 Librarieswhere mylibrary mfil e isthenameofanM-fileyouwouldliketousewhenloading this library. T his step only needs to be performed once to generate

Seite 54

C++ Shared Lib rary TargetC++SharedLibraryTargetIn this section...“C++ Shared Library Wrapper” on p age 7 -17“C++ Shared Library Example” on page 7-17

Seite 55 - Deployment Process

7 LibrariesWriting the Driver ApplicationNote Due to name mangling in C++, you must compile your driver applicationwith the same version of your third

Seite 56 - Over view

C++ Shared Lib rary Targetvoid *run_main(void *x){int *err = (int *)x;if (err == NULL) return 0;// Call application and library initialization. Perf o

Seite 57 - Deploying to P rogrammers

1Getting StartedWhat Is MATLAB Compiler? (p. 1-2)Brief summary of the p roductHow Does M ATLAB Compiler Work?(p. 1-3)High-level description of what th

Seite 58 - 4 Deployment Process

7 Librariesstd::cout << "Value of added matrix is:" << std::endl;std::cout << out << std::endl;multiplymatrix(1, out

Seite 59 - C or C++ Shared Library

C++ Shared Lib rary TargetCompiling the Driver ApplicationTo compile the matrixdriver.cpp driv er code, you use your C++ compiler.By executing the fol

Seite 60

7 LibrariesM-Functions with No Return Values.void <function-name>(< list _of_input_variables >);M-FunctionswithatLeastOneReturnValue.void

Seite 61 - Java Component

MATLAB Compiler Generated Interface FunctionsMATLAB Compiler Generated Interface FunctionsIn this section...“Functions in the Shared Library” on page

Seite 62

7 LibrariesFor a C++ Application o n Windowsmcc -W cpplib:libtrianglep -T link:lib sierpinski.mmbuild triangle.cpp main_for_l ib.c li btri anglep.libF

Seite 63 - Deploying to End Users

MATLAB Compiler Generated Interface FunctionsIn this example, MATLAB Compiler places all of the generated functions intothe generated filelibtriangle.

Seite 64

7 Librariesmost likely this is the version your application w ill call. In this example, thisform of the i nitialization function is calledlibtriangle

Seite 65 - MCRInstaller.zip

MATLAB Compiler Generated Interface Functionsyou modify the generated Dll Mai n (which we do not recomm end you do),make sure you preserve this part o

Seite 66

7 LibrariesHowever, the default implementation of the print handler is slightly different.It sends the output to the standard error output stream, but

Seite 67 - .NET Application

MATLAB Compiler Generated Interface FunctionsNote For C shared libraries, MATLAB Compiler generates the mlx and mlffunctions as described in this sect

Seite 68

1 Getting Star tedWhat Is MATLAB Compiler?In this section...“Overview of MATLAB Compiler” on page 1-2“What Is the Deployment Tool? ” on page 1-2Overvi

Seite 69 - Microsoft Excel Add-In

7 LibrariesNote that in both cases, the g enerated functions allocate memory for theirreturn values. If you do not delete this memory (viamxDestroyArr

Seite 70

MATLAB Compiler Generated Interface FunctionsForexample,considerthisM-fileinterface:[a,b,varargout] = myfun(x,y,z ,varargin)The corresponding C interf

Seite 71

7 LibrariesUsing C/C++ Shared Libraries on Mac OS XTo use a MATLAB Compiler generated library on Mac O S X, you must createa separat e thread tha t in

Seite 72

Using C/C++ Shared Libraries on M ac OS X**================================ =============================*/#include <stdio.h>#ifdef __APPLE_CC__

Seite 73

7 Librariesmemcpy(mxGetPr(in1), data, 9*sizeof(double));memcpy(mxGetPr(in2), data, 9*sizeof(double));/* Call the library intialization routine and mak

Seite 74 - Working with the MCR

Using C/C++ Shared Libraries on M ac OS X* mclTerminateApplica tion terminates the entire* application and exits with the exit code set using* mclSetE

Seite 75 - Modifying the Path

7 Librariesint main(){int err = 0;#ifdef __APPLE_CC__pthread_t id;pthread_create(&id, NULL, run_main, &err);CFRunLoopSourceContext sourceConte

Seite 76

Using C/C++ Shared Libraries on M ac OS X• You need to call mc lSet ExitCode with the appropriate exit status. Also,note that you should callmclTermin

Seite 77

7 LibrariesAbout Memory Management and CleanupIn this section...“Overview” on page 7-38“Passing m x Arrays to Share d Libraries” on page 7-3 8Overview

Seite 78

8Troubleshootingmbuild (p. 8-2)Issues in volving thembuild utilityand creating standalone applicationsMATLAB Compiler (p. 8-4)Issues involving MATLAB

Seite 79 - Developm en t Env iron ment

How Does MATLAB Compiler Wor k?How Does MATLAB Compiler Work?In this section...“MATLAB C ompiler Genera ted App l ication or L ib rary” on pag e 1-3“W

Seite 80 - Ser vices

8 TroubleshootingmbuildThis section identifies some of the more common p roblems that might occurwhen configuringmbuild to create standalone applicati

Seite 81 - Compiler Commands

mbuildbefore starting MATLAB. If this works correctly, then you should check your.cshrc file for problems setting the PATH environment variable.Cannot

Seite 82 - Command Overview

8 TroubleshootingMATLAB CompilerTypically, pro bl ems th at occur when buildin g stand alone C and C++applications involvembuild. However, it is possi

Seite 83 - Using File Extensions

MATLAB Compilerwhen you run your standalone that was generated by MATLAB Compiler, youshould check the following:• Do you have astartup.m file that ca

Seite 84

8 TroubleshootingTo verify tha t the MCR is prop erly loca ted on your path, from a developmentWindows machine, confirm thatmatlabroot\bin\win32,where

Seite 85 - Understanding a Macro Option

MATLAB Compilerat the beginning of your code and after the include statements, the warningwill not recur.8-7

Seite 86

8 TroubleshootingDeployed ApplicationsFailed to decrypt file. The M-file"<ctf_root>\toolbox\co mpiler\deploy\ matlabrc.m" cannot beexe

Seite 87 - Using Pathnames

Deployed Applications??? Error: File: /home/u se rna me/<M-file_na me>Line: 1651 Column: 8Argum ents to IMPORT must either end with ".*&quo

Seite 88 - Using Bundle Files

8 Troubleshooting• Ensure that your application runs in MATLAB (uncompiled) without thiserror.• Ensur e that MATLAB starts up without this error.• Ve

Seite 89

Deployed ApplicationsLinker cannot find library and fails to create standalone application(win32 and win64 ). If you try building your standalone appl

Seite 90 - <type>

1 Getting Star ted• For a library, contains the entry points for e ach public M-file function.Users of libraries generated by M ATLAB Compiler must ca

Seite 91 - C Library Wrapper

8 Troubleshooting8-12

Seite 92

9Reference InformationDirectories Required forDevelopment and Testing (p. 9-2)Path settings f o r machines whereyou want to develop and testapplicatio

Seite 93 - CExample

9 Reference InformationDirectories Required for Development and TestingIn this section...“Overview” on page 9-2“Path for Java Development on All Platf

Seite 94

Directories Required for Development and TestingUNIX Settings for Development and TestingWhen programming w ith components that are generated with MAT

Seite 95

9 Reference Informationmatlabroot/sys/java/jre/glnxa64/jre1.6.0/lib/amd64:setenv XAPPLRESDIR matlabroot/X11/app-defaultsMac OS Xsetenv DYLD_LIBRARY_PA

Seite 96

Directories Required for Run-Time D eploymentDirectories Required for Run-Time DeploymentIn this section...“Path for Java App l ications on All Platfo

Seite 97 - Using Pragmas

9 Reference InformationUNIX Paths for Run-Time DeploymentNote For readability, the fo llow ing commands appear on separate lines, butyou must enter ea

Seite 98

Directories Required for Run-Time D eploymentsetenv XAPPLRESDIR mcr_root/version/X11/app-defaultsMac OS Xsetenv DYLD_LIBRARY_PATHmcr_root/v ersion/run

Seite 99

9 Reference InformationUnsupported FunctionsSome functions are not supported in standalone mode; that is, you cannotcompile them with MATLAB Compiler.

Seite 100 - 5 Compiler Commands

Unsupported FunctionsList of Unsuppor ted Functions (Continued)dbstatusdbstepdbstopdbtypedbupdelete_blockdelete_linedepfundocechoeditfieldsfigure_pale

Seite 101 - Script Files

Before You BeginBefore You BeginBefore you can use MATLAB Compiler,youmusthaveitinstalledandconfigured properly on your system. Refer to Chapter 2, “I

Seite 102 - Compiler Tips

9 Reference InformationList of Unsuppor ted Functions (Continued)plotbrowserplottoolspropeditpropertyeditorpublishrehashset_paramsimsimgetsimsetsldebu

Seite 103

MAT LA B C omp iler Li censingMATLAB Compiler LicensingIn this section...“Deployed Applications” on page 9-11“Using MATLAB Compiler Lice ns es for D e

Seite 104

9 Reference Informationthe user gets a new 30-minute allotment. W hen the 30-minute interval haselapsed, if a different user requests MATLAB Compiler,

Seite 105

Using MCRInstaller.exe on the Command LineUsing MCRInstaller.exe on the C omm and LineIn this section...“Running MCRInstaller.exe” on page 9-13“Exampl

Seite 106

9 Reference InformationFrequently Used Options for MCRInstaller.exe (Contin ued)OptionTe ll s Insta llShield to.../sRun the installation in silent mod

Seite 107 - Application

Using MCRInstaller.exe on the Command LineThe followi ng co mmand:MCRInstaller.exe /v"/L *v \"C:\log.txt\""causes the installer to

Seite 108

9 Reference Information9-16

Seite 109 - Standalone Applications

10Functions — By CategoryPragmas (p. 10-2)Directives to MATLAB CompilerCommand-Line Tools (p. 10-2)Deployment-related commands

Seite 110 - Introduction

10 Functions — By CategoryPragmas%#externalPragma to call arbitrary C/C++functions from M-code%#functionPragma to help MATLAB Compilerlocate functions

Seite 111 - Testing the

11Functions — AlphabeticalList%#external%#functionbuilder2prjctfrootdeployprintdeploytoolisdeployedmbuildmcc

Seite 112 - 6 Standalone Applications

How to Contact The MathWorkswww.mathworks.comWebcomp.soft-sys.matlab Newsgroupwww.mathworks.com/contact_TS.html Technical [email protected]

Seite 113 - Intel Mac (Maci)

1 Getting Star tedUsing the GUI to C reate and Package a DeployableComponentOpen the Deployment Tool by issuing the following command at the MATLABpro

Seite 114

%#externalPurpose Pragma to call arbitrary C/C++ function s from M -codeSyntax %#externalDescription The %#external pragma informs MATLAB Compiler tha

Seite 115 - Running the Application

%#functionPurpose Pragma to help MATLAB Compiler locate functions called throughfeval, eval, or Handle G raphics® callbackSyntax %#function function1

Seite 116

%#functionfeval('bar');feval('foobar');end %function fooIn this example, mul t ip le functions (bar and foobar) are included inthe

Seite 117

builder2prjPurpose Convert project files with suffixes .cbl, .nbl,and.mxl to .prj(deploytool)formatSyntax builder2prjbuilder2prj([project.cbl,project

Seite 118

builder2prjbuilder2prj is run, converting the .mxl project t o a .prj project. Thenew project is namedrenamed_project.prj.11-6

Seite 119 - Coding with M-Files Only

ctfrootPurpose Root directory of a pplicatio n in deployed modeSyntax ctfrootDescription root = ctfroot returns a string that is the nam e of the dire

Seite 120

deployprintPurpose Use to print (as substitute for MATLAB print function) when workingwith deployed Windows applicationsSyntax deployprintDescription

Seite 121 - Mixing M-Files and C or C++

deployprint• Orientation• PrintHeaderNote deployprint requires write access to the file system in order towrite temporary files.Examples Thefollowingi

Seite 122

deploytoolPurpose Open GUI for MATLAB CompilerSyntax deploytoolDescription The deploytool command displays the Deployment Tool window, whichis the gra

Seite 123

isdeployedPurpose Determine whether code is running in deployed or MATLAB modeSyntax x = isdeployedDescription x = isdeployed returns true (1) when th

Seite 124

Magic Square ExampleMagic Square ExampleThis example shows you how to:• Access the examples provided with MATLAB Compiler.• UseMATLABCompilertocreatea

Seite 125 - Explanation of mrankp.c

mbuildPurpose Compile and link source files into standalone application or sharedlibrarySyntax mbuild [option1 ... optionN] sourcefile 1 [... sourcefi

Seite 126

mbuildOption Description-D<name>Define a symbol name to the C p reprocessor.Equivalent to a#define <name> directive inthe source.-D<nam

Seite 127

mbuildOption Description-nNo execute mode. Print out any commandsthatmbuild wo uld otherwise have ex ecuted,but do not actually execute any of them.-O

Seite 128

mbuildOption Description-vVerbose mode. Print the values for impo rtantinternal variables after the options file isprocessed and all command line argu

Seite 129 - Explanation of This C Code

mbuildNote MBUILD can also create shared libraries from C source code.If a file with the extension.exports is passe d to MBUILD, a sharedlibrary is bu

Seite 130

mccPurpose Invoke MATLAB CompilerSyntax mcc [-options] mfile1 [mfile2 ... mfileN][C/C++file1 ... C/C++fileN]Description mcc is the MATLAB command that

Seite 131 - Libraries

mccare added to the CTF archive, and the directory subtree in tes tdiris preserved in the CTF archive.If a wildcard pattern is included in the filenam

Seite 132

mccThe -a switch also creates a .auth file for authorization purposes.It ensures that the executable looks for the DLL- and H-files in theexe_mcr\exe

Seite 133

mccNote Do not terminate the output directory with aslash or backslash, e.g., usemcc -md C:\TEMP test.m.Do not usemcc -md C:\TEMP\ test.m.-e Suppress

Seite 134 - C Shared Library Target

mccto specify project_name as the project file name when calling mcc.Thisoption enables the.prj file, along with all of its associated settings, tobe

Seite 135

1 Getting Star ted4 While in MATLAB, type deploytool to open the Deployment Tool window.The Deployment Tool opens as a dockable window in the MATLAB d

Seite 136 - 7 Libraries

mcc-m Generate a Standalone ApplicationMacro to produce a standalone application. This macro is equivalent to-W main -T link:exeUse the -e option inst

Seite 137

mcctherelativeorderingoftheincludeddirectories. All subdirectoriesof the included directories that appear on the original path are alsoincluded. In ad

Seite 138

mccthe directory is added to the head of the path, as it normally wouldbe with-I.-R Run-TimeProvide MCR run-time options. Use the syntax-R optionto pr

Seite 139 - Based Shared Libraries

mccTarget DescriptioncodegenGenerates a C/C++ wrapper file. The default iscodegen.compile:exeSame as codegen plus compiles C/C++ files toobject form s

Seite 140

mccSyntax Description-w listGenerates a table that m aps <strin g>to warning me ssage for use with enable,disable,anderr or. Appendix B, “Errora

Seite 141 - Calling a Shared Library

mccappropriate global variable definitions. This table shows the validoptions.Type DescriptionmainProduces a POSIX shell main() function.lib:<strin

Seite 142

mcc-z pathto specify path to use for the compiler libraries and include files insteadof the path returned bymatlabroot.-? Help MessageDisplay MATLAB C

Seite 143

mccMake a standalone executable for myfun .m,butlookformyfun.m inthe/files/source directory a nd put the resulting C files and in the/files/target dir

Seite 144

mcc11-30

Seite 145

12Limitations andRestrictionsLimitations About What May BeCompiled (p. 12-2)Restrictions regarding what can becompiled

Seite 146

Magic Square Exampleat the bottom of the output pane. The Deployment Tool Output pane isdockable; by default it appears across the bottom of the MATLA

Seite 147 - C++SharedLibraryTarget

12 Limitations and Restriction sLimitations About What May Be CompiledIn this section...“Compiling MATLAB a nd Toolboxes ” on page 12-2“MATLAB Code” o

Seite 148

Limitations About What May Be CompiledNote Se e “ Un suppo rte d Functions” on page 9-8 for a complete list offunctions that cannot be compiled.MATLAB

Seite 149 - C++ Shared Lib rary Target

12 Limitations and Restriction sWorkaroundThere are several ways to eliminate this error.• Using the%#function pragma and specifying callbacks as stri

Seite 150

Limitations About What May Be CompiledFor more information on specifying the value of a callback, see Specifyingthe Value of Callback F unction Proper

Seite 151 - Exported Function Signature

12 Limitations and Restriction sCannot Create theOutputFileIf y ou receive the errorCan't create the output file filenamethere are several possib

Seite 152

Limitations About What May Be CompiledOlder Neural Networks Not Deployable withMATLAB CompilerLoading networks saved from older Neural Netw ork Toolbo

Seite 153 - Type of Application

12 Limitations and Restriction s12-8

Seite 154

AMATLAB Compiler QuickReferenceCommon Uses of MATLAB Compiler(p. A-2)Summary of how to use MATLABCompilermcc (p. A-4)Quick reference table of MATLABCo

Seite 155

A MATLAB Compiler Quick ReferenceCommon Uses of MATLAB CompilerIn this section...“Create a Standalone Application” on page A-2“Create a Library” on pa

Seite 156

Common Uses of MATLAB CompilerExample 2To create a C shared l ibrary called library_one from f oo1. m and foo2 .m,usemcc -W lib:library_one -T link:li

Seite 157

1 Getting Star tedUsing the mcc CommandInstead of the GUI, you can use the mcc command to run MATLAB Compiler.The following table shows sample command

Seite 158

A MATLAB Compiler Quick ReferencemccBold entries in the Comment/Options column indicate default values.Option Description Comment/Options-a filenameAd

Seite 159

mccOption Description Comment/Options-I directoryAdd directory to search pathfor M-files.MATLAB p ath i s automaticallyincluded when running from MATL

Seite 160

A MATLAB Compiler Quick ReferenceOption Description Comment/Options-w optionDisplay warning messages.option = listlevellevel:stringwhere level = disab

Seite 161

BError and WarningMessagesAbout Error and Warning Messages(p. B-2)How to use the error and warningmessages guideCompile-Time Errors (p. B-3)Error mess

Seite 162

B Error and Warning MessagesAbout Error and Warning MessagesThis appendix lists and describes error messages and warnings generatedby MATLAB Compiler.

Seite 163

Compile-Time ErrorsCompile-Time ErrorsError: An error occurred while shelling out to mex/mbuild (errorcode = errorno). Unable to build (specify the -v

Seite 164

B Error and Warning MessagesError: File: filename Line: # Column: # A variable cannot be madestorageclass1 after being used as a storageclass2. You ca

Seite 165

Compile-Time ErrorsError: The argument after the -option option must contain a colon.The format for this argument requires a colon. For more informati

Seite 166

B Error and Warning MessagesError: Unknown warning enable/disable string: warningstring. -wenable:, -w disable :,and-w error : requireyoutouseoneofthe

Seite 167

Warning MessagesWarning M essagesThis section lists the warning messages that MATLAB Compiler can generate.Using the-w option for mcc, you can control

Seite 168

Using the mcc CommandNote The -l option is a bundle option that expands into the following:-W lib -T link:libA bundle is a collection of mcc input opt

Seite 169

B Error and Warning MessagesWarning: The fil e filename was repeat ed on MATLA B Compilercommand line. (repeated_file) This warning occurs w hen the s

Seite 170 - 8 Troubleshooting

Warning MessagesNote A link error is produced if a call to this function is made from standalonecode.DEMO Com pi le r license. The generated a pplicat

Seite 171

B Error and Warning Messagesdepfun ErrorsIn this section...“About depfun Errors” on page B-10“MCR/Dispatcher Errors” on page B-10“XML Parser Errors” o

Seite 172 - MATLAB Compiler

depfun ErrorsWhere <message> is a message returned by the XML parser. If thiserror occurs, report it to Technical Support at The MathWorks athtt

Seite 173

B Error and Warning MessagesB-12

Seite 174

CC++ Utility LibraryReferencePrimitive Typ es (p. C-2)Primitive types that can be sto red ina MATLAB arrayUtility Classes (p. C-3)Utility classes used

Seite 175

C C++ Utility Library ReferencePrimitive TypesThe mwArray API supp orts all prim itive types th at can be stored in a MATLABarray. This table lists al

Seite 176 - Deployed Applications

Utility ClassesUtility ClassesThe follo wing are C++ utility classes:• “mwString Class” on page C-4• “mwException Class” on page C-20• “mwArray Class”

Seite 177

C C++ Utility Library ReferencemwString ClassIn this section...“About mwString” on page C-4“Constructors” on page C-4“Methods” on page C-4“Operators”

Seite 178

mwString Class• bool operator>(const mwStri ng& str) const• bool operator>=(cons t mwString& str ) const• friend std::ostream& opera

Seite 179

1 Getting Star tedDeveloping and Testing Components on a DevelopmentMachineIn this section...“Packaging Your Software” on p age 1-12“Replacement of MC

Seite 180

mwString()Purpose Construct empty stringC++Syntax#include "mclcppclass. h"mwString str;Arguments NoneReturnValueNoneDescription Use this con

Seite 181

mwString(const char* str)Purpose Construct new string and initialize strings data with supplied charbufferC++Syntax#include "mclcppclass. h"

Seite 182 - 9 Reference Information

mwString(const mwString& str)Purpose Copy constructor for mwStringC++Syntax#include "mclcppclass. h"mwString str("This is a string&

Seite 183 - Solaris64

int Le ng th() constPurpose Return number of characters in stringC++Syntax#include "mclcppclass. h"mwString str("This is a string"

Seite 184

operator const char* () constPurpose Return p ointer to internal bu ffer of stringC++Syntax#include "mclcppclass. h"mwString str("This

Seite 185

mwString& operator=(const mwString& str)Purpose mwString assignment operatorC++Syntax#include "mclcppclass. h"mwString str("Thi

Seite 186

mwString& operator=(const char* s tr)Purpose mwString assignment operatorC++Syntax#include "mclcppclass. h"const char* pstr = "This

Seite 187

bool operator==(const mwString& str) constPurpose Test two mwStrings for equalityC++Syntax#include "mclcppclass. h"mwString str("Th

Seite 188 - Unsupported Functions

bool operator!=(const mwString& str) constPurpose Test two mwStrings for inequali tyC++Syntax#include "mclcppclass. h"mwString str("

Seite 189

bool operator<(const mwString& str) constPurpose Compare input string with this string and return true if this string islexicographically less

Seite 190

Developing and Testing Components on a Development MachinePlatformFile ReplacingMCRInstalle r.zipFile LocationWindows32-bitMCRInstaller.exe matlabroot

Seite 191 - MATLAB Compiler Licensing

bool operator<=(const mwString& str) constPurpose Compare input string with this string and return true if this string islexicographically less

Seite 192

bool operator>(const mwString& str) constPurpose Compare input string with this string and return true if this string islexicographically great

Seite 193 - Running MCRInstaller.exe

bool operator>=(const mwString& str) constPurpose Compare input string with this string and return true if this string islexicographically grea

Seite 194

friend std::ostream& operator<<(std::ostream& os,const mwString& str)Purpose Copy contents of input string to specified ostreamC++Sy

Seite 195 - The followi ng co mmand:

C C++ Utility Library ReferencemwException ClassIn this section...“About mwException” on page C-20“Constructors” on page C-20“Methods” o n page C-20“O

Seite 196

mwException Class FunctionsmwException Class FunctionsThe following function is in the mwExceptionClass.C-21

Seite 197

mwException()Purpose Construct new mwException with default e rror mess ageC++Syntax#include "mclcppclass. h"throw mwException();Arguments N

Seite 198 - Command-Lin

mwException(const char* msg)Purpose Construct new mwException with spec ified error messageC++Syntax#include "mclcppclass. h"try{throw mwExc

Seite 199 - Functions — Alphabetical

mwException(const mwException& e)Purpose Copy constructor for mwException classC++Syntax#include "mclcppclass. h"try{throw mwException(&

Seite 200 - Syntax %#external

mwException(const std::exception& e)Purpose Create new mwException from existing std::exc eptionC++Syntax#include "mclcppclass. h"try{..

Seite 201 - %#function

1 Getting Star ted• The CTF archive that MATLAB Compiler creates for your com po ne ntConfiguring the Development Environment byInstalling the MCRTo t

Seite 202

const char *what() const throw()Purpose Return error message contained in this exceptionC++Syntax#include "mclcppclass. h"try{...}catch (con

Seite 203 - Examples Example 1

mwException& operator=(const mwException& e)Purpose Assignment operator for mwException classC++Syntax#include "mclcppclass. h"try{.

Seite 204

mwException& operator=(const std::exception& e)Purpose Assignment operator for mwException classC++Syntax#include "mclcppclass. h"tr

Seite 205 - Syntax ctfroot

mwArray ClassmwArray ClassIn this section...“About mwArray” on page C-29“Constructors” on page C-29“Methods” o n page C-30“Operators” o n page C-31“St

Seite 206 - Syntax deployprint

C C++ Utility Library Reference• mwArray(mwSize num_d ims, const mwSi ze* dims, int num_fields,const char** fieldnames)• mwArray(const mwArra y& a

Seite 207 - See Also isdeployed, print

mwArray Class• mwString ToString() const• mwArray RowIndex() const• mwArray ColumnIndex( ) const• void MakeComplex()• mwArray Get(mwSize num_indi ces,

Seite 208 - Syntax deploytool

C C++ Utility Library Reference• static double GetNaN()• static double GetEps()• static double GetInf()• static bool IsFinite(double x)• static bool I

Seite 209 - Syntax x = isdeployed

mwArray C lass FunctionsmwArray Class FunctionsThe following functi on is in the mwarray Class.C-33

Seite 210

mwArray()Purpose Construct empty array of type mxDOUBLE_CLA SSC++Syntax#include "mclcppclass. h"mwArray a;ReturnValueNoneDescription Use thi

Seite 211

mwArray(mxClassID mxID)Purpose Construct empty array of specified typeC++Syntax#include "mclcppclass. h"mwArray a(mxDOUBLE_CLA SS);ReturnVal

Seite 212

For More InformationFor M ore InformationAbout This Look HereDetailed information onstandalone applica t ion sChapter 6, “Standalone Applications”Crea

Seite 213

mwArray(mwSize num_rows, mwSize num_cols,mxClassID mxID, mxComplexity cmplx = mxREAL)Purpose Construct 2-D matrix of specified type and dimensionsC++S

Seite 214

mwArray(mwSize num_dims, const mwSize* dims,mxClassID mxID, mxComplexity cmplx = mxREAL)Purpose Construct n-dimensional array of specified ty pe and d

Seite 215 - Options -a Add to Archive

mwArray(const char* str)Purpose Construct character array from supplied stringC++Syntax#include "mclcppclass. h"mwArray a("This is a st

Seite 216

mwArray(mwSize num_strings, const char** str)Purpose Construct character matrix from list of stringsC++Syntax#include "mclcppclass. h"const

Seite 217 - -c Generate C Code Only

mwArray(mwSize num_rows, mwSize num_cols, intnum_fields, const char** fieldnames)Purpose Construct 2-D MATLAB structure matrix of specified dimensions

Seite 218 - -F Specified Project File

mwArray(mwSize num_dims, const mwSize* dims, intnum_fields, const char** fieldnames)Purpose Construct n-dimensional MATLAB structure array of specifie

Seite 219 - -G Debug Only

mwArray(const mwArray& arr)Purpose mwArray copy constructor. Constructs new array from existing oneC++Syntax#include "mclcppclass. h"mwA

Seite 220 - -N Clear Path

mwArray(<type> re)Purpose Construct real scalar array of type of the input argument and initializedata with input argument’s valueC++Syntax#incl

Seite 221 - -p Add Directory to Path

mwArray(<type> re, <type> im)Purpose Construct complex scalar array of type o f input arguments and initializereal and imaginary parts of

Seite 222 - -T Specify Target Stage

mwArray Clone() constPurpose Return new array representing deep copy of arrayC++Syntax#include "mclcppclass. h"mwArray a(2, 2, mxDOUBLE_CLAS

Seite 223 - -w Warning Messages

Revision HistorySeptember 1995 First printingMarch 1997 Second printingJanuary 1998 Third printing Revised for Version 1.2January 1999 Fourth printing

Seite 224 - -W Wrapper Function

1 Getting Star ted1-16

Seite 225 - -z Specify Path

mwArray SharedCopy() constPurpose Return new array representing shared copy of arrayC++Syntax#include "mclcppclass. h"mwArray a(2, 2, mxDOUB

Seite 226 - -? Help Message

mwArray Serialize() constPurpose Serialize underlying array into byte array, and return this data in newarray of typemxUINT8_CLASSC++Syntax#include &q

Seite 227

mxClassID ClassID() constPurpose Return type of arrayC++Syntax#include "mclcppclass. h"mwArray a(2, 2, mxDOUBLE_CLASS);mxClassID id = a.Clas

Seite 228

int ElementSize() constPurpose Return size in bytes of element of arrayC++Syntax#include "mclcppclass. h"mwArray a(2, 2, mxDOUBLE_CLASS);int

Seite 229 - Restrictions

size_t ElementSize() constPurpose Return size in bytes of an element of arrayC++Syntax#include "mclcppclass. h"mwArray a(2, 2, mxDOUBLE_CLAS

Seite 230 - Limitations and Restriction s

mwSize NumberOfElements() constPurpose Return number of elements in arrayC++Syntax#include "mclcppclass. h"mwArray a(2, 2, mxDOUBLE_CLASS);i

Seite 231 - MATLAB Code

mwSize NumberOfNonZeros() constPurpose Return num ber of nonzero elements for sparse arrayC++Syntax#include "mclcppclass. h"mwArray a(2, 2,

Seite 232 - Workaround

mwSize MaximumNonZeros() constPurpose Return maximum number of nonzero elements for sparse arrayC++Syntax#include "mclcppclass. h"mwArray a(

Seite 233 - Suppressing Warnings on UNIX

mwSize NumberOfDimensions() constPurpose Return number of dimensions in arrayC++Syntax#include "mclcppclass. h"mwArray a(2, 2, mxDOUBLE_CLAS

Seite 234

int N umberOfFields() constPurpose Return number of fields in struct arrayC++Syntax#include "mclcppclass. h"const char* fields[] = {"a&

Seite 235 - Older Neural Net

2Installation andConfigurationThis chapter describes the system requirements for MATLAB Compiler. Italso contains installation and configuration infor

Seite 236

mwString GetFieldName(int index)Purpose Return string representing name of (zero-based) field in struc t arrayC++Syntax#include "mclcppclass. h&q

Seite 237 - Reference

mwArray GetDimensions() constPurpose Return array of type m xINT 32_CLASS representing dimensions of arrayC++Syntax#include "mclcppclass. h"

Seite 238 - Create a Library

bool IsEmpty() constPurpose Return true if underlying array is emptyC++Syntax#include "mclcppclass. h"mwArray a;bool b = a.IsEmpty(); // Sho

Seite 239 - Example 2

bool IsSparse() constPurpose Return true if underlying array is sparseC++Syntax#include "mclcppclass. h"mwArray a(2, 2, mxDOUBLE_CLASS);bool

Seite 240

bool IsNumeric() constPurpose Return true if underlying array is numericC++Syntax#include "mclcppclass. h"mwArray a(2, 2, mxDOUBLE_CLASS);bo

Seite 241

bool IsComplex() constPurpose Return true if underlying array is complexC++Syntax#include "mclcppclass. h"mwArray a(2, 2, mxDOUBLE_CLASS, mx

Seite 242

bool Equals(const mwA rray& arr) constPurpose Test two arrays for equalityC++Syntax#include "mclcppclass. h"mwArray a(1, 1, mxDOUBLE_CLA

Seite 243 - Error and Warning

int CompareTo(const mwArray& arr) constPurpose Compare two arrays for orderC++Syntax#include "mclcppclass. h"mwArray a(1, 1, mxDOUBLE_CL

Seite 244 - B Error and Warning Messages

int HashCode() constPurpose Return hash code for arrayC++Syntax#include "mclcppclass. h"mwArray a(1, 1, mxDOUBLE_CLASS);int n = a.HashCode()

Seite 245 - Compile-Time Errors

mwString ToString() constPurpose Return string representation of underlying arrayC++Syntax#include <stdio.h>#include "mclcppclass. h"m

Seite 246

2 Installation and ConfigurationRequirementsIn this section...“System Requirements” on page 2-2“Supported Third-Party Compilers” on p age 2-2System Re

Seite 247

mwArray RowIndex() constPurpose Return array containing row indices of each element in arrayC++Syntax#include <stdio.h>#include "mclcppclas

Seite 248

mwArray ColumnIndex() constPurpose Return array containing column indices of each element in arrayC++Syntax#include "mclcppclass. h"mwArray

Seite 249 - Warning M essages

void MakeComplex()Purpose Convert real numeric array to complexC++Syntax#include "mclcppclass. h"double rdata[4] = {1.0, 2.0, 3.0, 4.0};doub

Seite 250

mwArray Get(mwSize num_indices, ...)Purpose Return single element at specified 1-based indexC++Syntax#include "mclcppclass. h"double data[4]

Seite 251 - Warning Messages

mwArray Get(const char* name, mwSize num_indices,...)Purpose Return single element at specified field name and 1-based index instruct arrayC++Syntax#i

Seite 252

mwArray Get(const char* name, mwSize num_indices,...)mwException is thrown if an invalid number of indices is passed inor if any index is out of bound

Seite 253

mwArray G etA(mwSize num_indices, const mwIndex*index)Purpose Return single element at specified 1-based indexC++Syntax#include "mclcppclass. h&q

Seite 254

mwArray GetA(const char* name, mwSizenum_indices, const mwIndex* index)Purpose Return single element at specified field name and 1-based index instruc

Seite 255 - C++ Utility Library

mwArray GetA(const char* name, mwSize num_indices,const mwIndex* index)thrown if an invalid number of indices is passed in or if any index isout of bo

Seite 256 - Primitive Types

mwArray R eal()Purpose Return mwArray that references real part of complex arrayC++Syntax#include "mclcppclass. h"double rdata[4] = {1.0, 2.

Seite 257 - Utility Classes

RequirementsSupported ANSI C and C++ Windows CompilersUse one of the following 32-bit C/C++ com pilers that create 32-bit Windowsdynamically linked li

Seite 258 - Operators

mwArray Imag()Purpose Return mwArray that references imaginary part of complex arrayC++Syntax#include "mclcppclass. h"double rdata[4] = {1.0

Seite 259

void Set(const mwArray& arr)Purpose Assign shared copy of input array to currently referenced cell for arraysof typemxCELL_CLASS and m xSTR UCT_CL

Seite 260 - Construct empty string

void GetData(<numeric-type>* buffer, mwSize len) constPurpose Copy array’s data into supplied numeric bufferC++Syntax#include "mclcppclass.

Seite 261

void GetLogicalData(mxLogical* buffer, mwSize len)constPurpose Copy array’s data into supplied mxLogical bufferC++Syntax#include "mclcppclass. h&

Seite 262

void GetCharData(mxChar* buffer, mwSize len) constPurpose Copy array’s data into supplied mxChar bufferC++Syntax#include "mclcppclass. h"mxC

Seite 263

void SetData(<numeric-type>* buffer, m wSize le n)Purpose Copy data from supplie d numeric buf fe r i nto arrayC++Syntax#include "mclcppcla

Seite 264

void SetLogicalData(mxLogical* buffer, mwSize len)Purpose Copy data from supplied mxLog ical buffer into arrayC++Syntax#include "mclcppclass. h&q

Seite 265 - String to make a copy of

void SetCharData(mxChar* buffer, mwSize len)Purpose Copy data from supplied mxChar buffer into arrayC++Syntax#include "mclcppclass. h"mxChar

Seite 266

mwArray operator()(mwIndex i1, mwIndex i2,mwIndex i3, ..., )Purpose Return single element at specified 1-based indexC++Syntax#include "mclcppclas

Seite 267 - The result of the comparison

mwArray operator()(const char* name, mwIndex i1,mwIndex i2, mwIndex i3, ..., )Purpose Return single element at specified field name and 1-based index

Seite 268

2 Installation and ConfigurationInstallationIn this section...“Installing MATLAB Compiler” on pa ge 2-4“Installing an A NSI C or C ++ C ompiler” on pa

Seite 269

mwArray& operator=(const <type>& x)Purpose Assign single scalar value to a rrayC++Syntax#include "mclcppclass. h"mwArray a(2,

Seite 270

operator <type>() constPurpose Fetch single scalar value from arrayC++Syntax#include "mclcppclass. h"double data[4] = {1.0, 2.0, 3.0,

Seite 271

static mwArray Deserialize(const mwArray& arr)Purpose Deserialize array that was serialized with mwArra y::S erializeC++Syntax#include "mclcp

Seite 272

static double GetNaN()Purpose Get value of NaN (Not-a-Nu mber)C++Syntax#include "mclcppclass. h"double x = mwArray::GetNaN();Arguments NoneR

Seite 273 - The input os tream

static double GetEps()Purpose Get value of epsC++Syntax#include "mclcppclass. h"double x = mwArray::GetEps();Arguments NoneReturnValueThe va

Seite 274 - About mwException

static dou b le GetInf()Purpose Get value of Inf (infinity )C++Syntax#include "mclcppclass. h"double x = mwArray::GetInf();Arguments NoneRet

Seite 275

static bool IsFinite(double x)Purpose Test if value is finite and re turn true if value is finiteC++Syntax#include "mclcppclass. h"bool x =

Seite 276

static bool IsInf(double x)Purpose Test if valu e is infinite and return true if value is infiniteC++Syntax#include "mclcppclass. h"bool x =

Seite 277 - Error message

static bool IsNaN(double x)Purpose Test if value is NaN (Not-a-Number) and return true if value is NaNC++Syntax#include "mclcppclass. h"bool

Seite 278

IndexIndexAaddpath command 4-18AddressingExtended2 GB Limit 7-3Advanced Encryption Standard (AES)cryptosystem 3-2ANSI compilerinstalling 2-5applicatio

Seite 279

InstallationCompiler does not appear as one of the installation choices, contact TheMathWorks to get an updated license file (license.dat).Installing

Seite 280

IndexDdebugging 5-24-G option flag 11-21dependency analysis 3-4depfun 4-17deployed applicationslicensing 9-11troubleshooting 8-8using relative path 5-

Seite 281

IndexG-G option flag 11-21GUIcompiling with ActiveX controls 5-24deployingas shared library 5-28displaying 5-28HHandle Graphics 12-5Iinput/output file

Seite 282

Indexoptions 5-2summarized A-4syntax 10-2 11-17system requirementsUNIX 2-2troubleshooting 8-4warning messages B-2MATLAB Compiler license 9-11MATLAB Co

Seite 283 - About mwArray

Indexpathnameshandling full 5-7PLP (personal license password) 2-4porting code 4-15POSIX m ain application 5-10POSIX main wrapper 5-10pragma%#external

Seite 284

Indexoptions file 2-9locating 2-12Windows compilerlimitations 2-11wrapper code g ene ration 3-5wrapper file 1-3wrapper function 5-10wrappersC shared l

Seite 285 - Static Methods

2 Installation and ConfigurationWindows (Continued)Issue CommentRunning from the command line Make sure you select all relevantoptions for running you

Seite 286

ConfigurationConfigurationIn this section...“About the m build Utility” on page 2-7“Configuring an ANSI C or C++ Compiler” on page 2-7About the mbuild

Seite 287

2 Installation and ConfigurationWhen you select a compiler to use with M ATLAB C ompiler, the correspondingoptions file is activated on your system. T

Seite 288

ConfigurationPlease verify your choices:Compiler: Microsoft Visual C/C++ 2005Location: D:\Applicati ons\ Microsoft Visua l StudioAre these correct?([y

Seite 290

2 Installation and Configurationmbuild -setupUsing the 'mbuild -setup' command selects an options file that isplaced in ~/.matlab/current_re

Seite 291

Suppor ted Compiler RestrictionsSupported Compiler RestrictionsThe known restrictions regarding the use of supported compilers on Windowsare:• The LCC

Seite 292

2 Installation and ConfigurationOptions FilesIn this section...“Locating the Options File” on page 2-12“Changing the Options File” on page 2-13Locatin

Seite 293

Options Files• Current directory•$HOME/.matlab/current_release• matlabroot/binmbuildusesthefirstoccurrenceoftheoptionsfileitfinds.Ifnooptionsfileisfou

Seite 294

2 Installation and Configurationdefault options files (other MATLAB products may place options files in thisdirectory). Do not confuse these us er-spe

Seite 295

3Compilation ProcessThis chapter provides an overview of how MATLAB Compiler works. Inaddition, i t lists the various sets of input and output files u

Seite 296

3 Compilation ProcessOver view of MATLA B Compiler Te chnologyIn this section...“MATLAB Component Runtime” on page 3-2“Component Technology File” on p

Seite 297

Overview of MATLAB Compiler TechnologyAdditional DetailsMultiple CTF archive s, such as COM , .NET, o r Excel components, can coexistin the same user

Seite 298

3 Compilation ProcessCreating a Standalone ExecutableDependency AnalysisThe first step determines all the functions on which the supplied M-files,MEX-

Seite 299

Overview of MATLAB Compiler TechnologyWrapper Code GenerationThis s tep generates all the source code needed to create the target component,including•

Seite 300

ContentsGetting Started1What Is MATLAB Compiler?...1-2Overview o f MATLAB Compiler...1-2What Is the Deployment

Seite 301

3 Compilation ProcessInput and Output FilesIn this section...“Standalone Executable” on page 3-6“C Shared Library” on page 3-7“C++ Shared Library” on

Seite 302

Input and Output FilesCSharedLibraryIn this example,MATLAB C ompiler takes the M-filesfoo.m and bar.m asinput and generates a C shared library calledl

Seite 303

3 Compilation ProcessFile DescriptionlibfooThe shared library binary file. On Windows,this file islibfoo.dll. On Solaris, this file islibfoo.so.Note U

Seite 304

Input and Output FilesC++ Shared LibraryIn this example,MATLAB C ompiler takes the M-filesfoo.m and bar.m asinput and generates a C++ shared library c

Seite 305 - Number of elements in array

3 Compilation ProcessFile Descriptionlibname.expExports file used by the linker. The linker usestheexportfiletobuildaprogramthatcontainsexports (usual

Seite 306 - NumberOfElements()

4Deployment ProcessThis chapter tells you h ow to deploy compiled M-code to programmers andto end users.Overview (p. 4-2)Describes the deployment proc

Seite 307

4 Deployment ProcessOver viewAfter you create a library, a component, or an application, the next stepistypicallytodeployittootherstouseontheirmachine

Seite 308

Deploying to ProgrammersDeploying to P rogrammersIn this section...“StepsbytheProgrammertoDeploytoProgrammers”onpage4-3“What Software Does a Programme

Seite 309

4 Deployment ProcessWhat Software Does a Programmer Need?ThesoftwarethatyouprovidetoaprogrammerwhowantstousecompiledM-code depends on w hich of the fo

Seite 310

Deploying to ProgrammersSoftware Mo duleDescriptionMATLAB_Component_Runtime.dmg(Mac)MATLAB_Component_Runtime.dmg is aself-extracting executable that i

Seite 311

Installation and Configuration2Requirements ... 2-2System Requirem ents... 2-2Supported T

Seite 312

4 Deployment ProcessSoftware M od ule Descriptionlibmatrix.ctfComponent Technology File archive;platform-dependent file that must correspond tothe end

Seite 313

Deploying to ProgrammersSoftwar e ModuleDescriptioncomponentname_version.dllComponent that contains compiled M-code.MCRInstaller.exeSelf-extracting MA

Seite 314

4 Deployment ProcessSoftware ModuleDescriptionMCRInstaller.exeSelf-extracting M ATLABComponent Runtime libraryutility; platform-dependent filethat mus

Seite 315

Deploying to End UsersDeploying to End UsersIn this section...“Steps by the Programmer to Deploy to End Users” on page 4-9“What Software Does the End

Seite 316

4 Deployment ProcessNote The package needed for end users must include the .ctf file, whichincludes all the files in your prefere nces directory. Thus

Seite 317

Deploying to End UsersNote for Windows Applications You must have administrative privilegesto install the MCR on a target machine since it modifies bo

Seite 318

4 Deployment ProcessTheinstallationbegins.Theprocesstakessometimeduetothequantityoffiles that are installed.The MCRInstaller au t omatically:• Copies

Seite 319

Deploying to End UsersComponent DescriptionMCRInstaller.exe(Windows)Self-extracting MATLAB Component Runtimelibrary utility ; platform-dependen t fil

Seite 320

4 Deployment ProcessSoftware ModuleDescriptioncomponentName.dllComponent assembly fileMCRInstaller.exeMCR Installer (if not already installed on theta

Seite 321

Deploying to End UsersSoftware Mod uleDescriptioncomponentname.ctfComponent Technology Filecomponentname.jarJava package conta ining Java inter face t

Seite 322

Deployment Process4Overview ... 4-2DeployingtoProgrammers...4-3Steps by the Programmer to

Seite 323 - is returned

4 Deployment Processapplication to a Windows machine, you must use the Windows version ofMATLAB Compiler to build the application on a Windows machine

Seite 324

Deploying to End UsersNote To run extractCTF from any directory, you must addmatlabroot/toolbox/compiler/deploy/arch to your PATH environmentvariable.

Seite 325

4 Deployment Process• addpath and rmpath in MATLAB• Passing-I <directory> on the mcc command line• Passing-N and -p directories on the mcc comma

Seite 326

Deploying to End UsersIt also retains a ll subdirecto ries of th e above list that appear on the MATLABpath a t compil e time. Inclu ding-N on the com

Seite 327

4 Deployment ProcessWorking with the MCRIn this section...“Understanding the MCR” on page 4-20“Installing the MCR and MATLAB on the Same Machine” on p

Seite 328

Working with the MCRNote MCRInstaller.exe has obsoleted the need for the function buil dmcr orthe creation ofMCRInstaller.zip. See “Replaceme nt of MC

Seite 329

4 Deployment ProcessUNIX. To run deployed components on Linux, Linux x86-64, or Solaris,the<mcr_root>/run time/<a rch> directory must appe

Seite 330

Working with the MCRNote The feature that allows you to install multiple versio n s of the MCR onthe same machine is currently not supported on Mac OS

Seite 331

4 Deployment ProcessDeploying a Standalone Application on a Network DriveYou can deploy a compiled standalone a pp lica tion to a network d r iv e so

Seite 332

MATLAB Compiler Deployment M essagesMATLAB Compiler Deployment MessagesTo enable display of MATLAB C ompiler deployment mes sag es, see “ShowMATLAB Co

Seite 333

Comb ining Options ... 5-2Conflicting Options on the Command Line... 5-3Using File Extensions...

Seite 334

4 Deployment ProcessUsing MATLAB Compiler Generated DLLs in WindowsSer vicesIf you have a Windows serv ice that is built using DLL file s generated by

Seite 335

5Compiler CommandsThis chapter describes mc c, which is the command that invokes MATLABCompiler.Command Overview (p. 5-2)Details on using themcc comm

Seite 336

5 Compiler CommandsCommand OverviewIn this section...“Compiler Options” on page 5-2“Combining Options” on page 5-2“Conflicting Options on the Command

Seite 337

Command Overviewmcc -vW main -T link:exe myfun % Options combinedThis format is not valid:mcc -Wv main -T link:exe myfunIn cases where you have more t

Seite 338

5 Compiler Commandsextension, whe n comp il in g with mcc or you may encounter unpredictableresults.Note P-files (.p) have precedence over M-files, th

Seite 339

Using Macros to Simplify CompilationUsing Macros to S implify CompilationIn this section...“Macro Options” on page 5-5“Understanding a Macro Option” o

Seite 340 - Value to assign

5 Compiler Commands-m MacroOption Function-W mainProduce a wrapper file suitable for a standaloneapplication.-T link:exeCreate an executable link as t

Seite 341

Using PathnamesUsing PathnamesIfyouspecifyafullpathnametoanM-fileonthemcc comm and line, MATLABCompiler1 Breaks the full name into the corresponding p

Seite 342

5 Compiler CommandsUsing Bundle FilesBundle files provide a convenient way to group sets of MATLAB Compileroptions and recall them as needed. The synt

Seite 343

Using Bundle FilesNote You can us e the -B option with a replacem ent expression as is at theDOS or UNIX prompt. To use-B with a replacement expressio

Seite 344

Blocking Execution of a Console Application That CreatesFigures and Terminating Figures by Force... 5-25Passing A rguments to and from a Stand

Seite 345

5 Compiler CommandsUsing Wrapper FilesIn this section...“What Are Wrapper Files?” on page 5-10“MainFileWrapper”onpage5-10“C Library Wrapp er” on page

Seite 346 - -Inf an d les s than Inf

Using Wrapper Filesy=0;You can compile sa mple.m in to a POSIX main applica t io n . If y o u call samplefrom MATLAB, you getsample hello worldans =he

Seite 347

5 Compiler Commandsof the compiled M-functions. The export list contains the set of symbols thatare exported from a C shared library.Note You must gen

Seite 348

Interfacing M-Co de to C/C++ CodeInter facing M -Code to C/C++ CodeIn this section...“Overview” on page 5-13“C Ex ample” on page 5-13OverviewMATLAB Co

Seite 349

5 Compiler Commandst = t + 0.05;y = sin(t);The next step is to replace the implementation of the collect_one functionwith a C impleme ntatio n that pr

Seite 350

Interfacing M-Co de to C/C++ Code%#externalpersistent t;if (isempty(t))t=0;endt = t + 0.05;y = sin(t);When this file is compi led , MATLA B Compiler c

Seite 351

5 Compiler Commandsstatic double t = 0.0;t = t + 0.05;return sin(t);}To generate the application, usemcc -m collect.m measure.cNote For information on

Seite 352

Using PragmasUsing PragmasIn this section...“Using feval” on page 5-17“Example: Using %#function” on page 5-17Using fevalIn standalone C and C++ modes

Seite 353

5 Compiler Commands%#function bartlett, barthannw in, bla ckma n, black manh arris,bohmanwin, chebwin, flattopwin , gauss win, hamming, hann, kaiser,n

Seite 354 - -z option flag 11-27

Script FilesScript FilesIn this section...“Converting S cript M-Files to Function M-Files” on page 5-19“Including Script Files in Deployed Application

Kommentare zu diesen Handbüchern

Keine Kommentare