Contenuto principale

La traduzione di questa pagina non è aggiornata. Fai clic qui per vedere l'ultima versione in inglese.

Specifiche di input

Specificare le proprietà delle variabili di input delle funzioni di MATLAB® per consentire la generazione di codice

Per la generazione di codice, è necessario specificare le grandezze e i tipi di variabili di input per la funzione del punto di ingresso. È possibile specificare i tipi di input come segue:

  • Nel codice MATLAB, eseguendo la validazione degli argomenti della funzione del punto di ingresso utilizzando i blocchi arguments. Se si specificano i tipi di input utilizzando i blocchi arguments, è inoltre possibile specificare altri attributi delle variabili, tra cui la natura complessa, sparsa o come array GPU dei dati di input, utilizzando validatori come coder.mustBeComplex.

  • Utilizzando l'app MATLAB Coder™.

  • Dalla riga di comando, utilizzando l'argomento -args nel comando codegen. I tipi di input specificati alla riga di comando utilizzando l'argomento -args possono essere preconfigurati utilizzando coderTypeEditor o funzioni come coder.typeof.

  • Nel codice MATLAB, eseguendo il precondizionamento utilizzando le dichiarazioni assert.

App

MATLAB CoderGenerare codice C o funzione MEX da codice MATLAB

Funzioni

espandi tutto

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 (Da R2023b)
coder.specifyAsGPUSpecify that value is a GPU input to an entry-point function for GPU code generation (Da 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 (Da R2023b)
assertThrow error if condition false

Classi

espandi tutto

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 (Da R2022b)
coder.TypeRepresent set of MATLAB values acceptable for input specification

Oggetti

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

Argomenti

Nozioni di base sulle specifiche di input

Specifica dei tipi di input nel codice MATLAB

Specifica dei tipi di input utilizzando l'app MATLAB Coder

Specifica dei tipi di input dalla riga di comando

Risoluzione dei problemi