Hauptinhalt

Die Übersetzung dieser Seite ist veraltet. Klicken Sie hier, um die neueste Version auf Englisch zu sehen.

Eingabespezifikation

Angeben der Eigenschaften von MATLAB®-Funktionseingang-Variablen für die Codegenerierung

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 von arguments-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 wie coder.mustBeComplex.

  • Mithilfe der MATLAB Coder™ App.

  • Über die Befehlszeile mit dem Argument -args für den Befehl codegen. Über die Befehlszeile mit dem Argument -args festgelegte Eingabetypen können mithilfe von coderTypeEditor oder Funktionen wie coder.typeof vorkonfiguriert werden.

  • In Ihrem MATLAB-Code, indem Sie eine Vorkonditionierung mithilfe von assert-Ausdrücken durchführen.

Apps

MATLAB CoderGenerieren von C Code oder MEX-Funktionen aus MATLAB Code

Funktionen

alle erweitern

codegenGenerate C/C++ code from MATLAB code
coder.getArgTypesDetermine types of function input arguments by executing test file
coder.newtypeCreate coder.Type object to represent type of an entry-point function input
coder.resizeResize coder.Type object
coder.typeofCreate coder.Type object to represent the type of an entry-point function input
coderTypeEditorLaunch the Coder Type Editor dialog box
argumentsDeclare function argument validation
coder.mustBeComplexValidate that value lies on the complex plane (Seit R2023b)
coder.specifyAsGPUSpecify that value is a GPU input to an entry-point function for GPU code generation (Seit R2023b)
coder.varsizeResolve size incompatibility errors and declare upper bounds
mustBeAValidate that value comes from one of specified classes
mustBeNonsparseValidate that value is nonsparse
mustBeRealValidate that value is real
mustBeSparseValidate that value is sparse (Seit R2023b)
assertThrow error if condition false

Klassen

alle erweitern

coder.ArrayTypeRepresent set of MATLAB arrays acceptable for input specification
coder.CellTypeRepresent set of MATLAB cell arrays
coder.ClassTypeRepresent set of MATLAB classes acceptable for input specification
coder.ConstantSpecification of constant value for code generation
coder.EnumTypeRepresent set of MATLAB enumerations acceptable for input specification
coder.FiTypeRepresent set of MATLAB fixed-point arrays acceptable for input specification
coder.PrimitiveTypeRepresent set of logical, numeric, or character arrays acceptable for input specification
coder.StructTypeRepresent set of MATLAB structure arrays acceptable for input specification
coder.StringTypeRepresent set of MATLAB strings acceptable for input specification (Seit R2022b)
coder.TypeRepresent set of MATLAB values acceptable for input specification

Objekte

coder.OutputTypeOutput type from an entry-point function to specify as an input type

Themen

Grundlagen der Eingabespezifikation

Festlegen von Eingabetypen in MATLAB-Code

Festlegen von Eingabetypen mithilfe der MATLAB Coder App

Festlegen von Eingabetypen über die Befehlszeile

Fehlerbehebung