Eingabespezifikation
Für die Codegenerierung müssen Sie die Größen und Typen der Eingangsvariablen der Einstiegspunkt-Funktion angeben. Sie können die Eingabetypen folgendermaßen festlegen:
In Ihrem MATLAB-Code, indem Sie die Funktionsargument-Validierung in der Einsteigspunkt-Funktion mithilfe von
arguments
-Blöcken durchführen. Wenn Sie Eingabetypen mithilfe vonarguments
-Blöcken festlegen, können Sie zudem weitere Variablenattribute angeben, darunter auch, ob die Eingangsdaten komplex, dünn besetzt oder ein GPU-Array sind; hierfür verwenden Sie Validatoren wiecoder.mustBeComplex
.Mithilfe der MATLAB Coder™ App.
Über die Befehlszeile mit dem Argument
-args
für den Befehlcodegen
. Über die Befehlszeile mit dem Argument-args
festgelegte Eingabetypen können mithilfe voncoderTypeEditor
oder Funktionen wiecoder.typeof
vorkonfiguriert werden.In Ihrem MATLAB-Code, indem Sie eine Vorkonditionierung mithilfe von
assert
-Ausdrücken durchführen.
Apps
MATLAB Coder | Generieren von C Code oder MEX-Funktionen aus MATLAB Code |
Funktionen
Klassen
Objekte
coder.OutputType | Output type from an entry-point function to specify as an input type |
Themen
Grundlagen der Eingabespezifikation
- Specify Types of Entry-Point Function Inputs
How and why to perform input-type specification.
Festlegen von Eingabetypen in MATLAB-Code
- Use Function Argument Validation to Specify Entry-Point Input Types
Specify the types of the entry-point function inputs using anarguments
block. - Specify Input Types Using assert Statements in MATLAB Code
Specify the types of entry-point function inputs by using theassert
function.
Festlegen von Eingabetypen mithilfe der MATLAB Coder App
- Define Types of Entry-Point Inputs by Using the MATLAB Coder App
Specify the types of entry-point function inputs using the MATLAB Coder app. - Define Global Variables in the MATLAB Coder App
Use the MATLAB Coder app to specify the types and initial values of global variables that your MATLAB code uses.
Festlegen von Eingabetypen über die Befehlszeile
- Specify Input Types at the Command Line
Specify entry-point function input type by using the-args
option. - Create and Edit Input Types by Using the Coder Type Editor
Define and editcoder.Type
objects interactively. - Specify Cell Array Inputs at the Command Line
Provide an example cell array, define a cell array type, or specify a cell array constant input. - Specify Global Cell Arrays at the Command Line
Specify global cell array inputs with the-globals
option. - Specify Value Class Objects as Inputs
Specify that an entry-point input is an object of a value class. - Pass an Entry-Point Function Output as an Input
Simplify input type specification for multiple entry-point functions. - Specify String Scalar Inputs at the Command Line
Specify string scalar inputs at the command line. - Specify Number of Input or Output Arguments to Entry-Point Functions
Control the number of input or output arguments in the generated code.
Fehlerbehebung
- Resolve Issue: Using arguments Blocks to Specify Cell or Structure Entry-Point Input Types is Not Supported
Troubleshoot code generation error if cells or structs are used for input-type specification in the arguments block of an entry-point function.