clibgen.api.InputArgumentDefinition
R2026bDescription
A clibgen.api.InputArgumentDefinition object represents the
MATLAB® definition of an input parameter to a C++ function or method.
Creation
creates an inputs
definition object from the inArgs = ctor.CPPInputsCPPInputs property of a clibgen.api.ConstructorDefinition
object.
creates an inputs
definition object from the inArgs = fcn.CPPInputsCPPInputs property of a clibgen.api.FunctionDefinition
object.
creates an inputs
definition object from the inArgs = methDef.CPPInputsCPPInputs property of a clibgen.api.MethodDefinition
object.
Properties
This property is read-only.
C++ parameter name, represented as a string scalar.
This property is read-only.
Argument position in the function signature, represented as an integer.
This property is read-only.
C++ parameter type, represented as a string scalar.
Data type for the argument in MATLAB, specified as a string scalar.
How the input argument is used, specified as one of these values:
"input"— Input argument onlyIf a pointer argument is used to pass data to the function, then it appears as an input argument in the MATLAB signature.
The
Directionvalue for C-string parameters must be"input"."output"— Output argument onlyIf a pointer argument is used to retrieve data from the function, then it must appear as an output argument in the MATLAB signature.
"inputoutput"— Input and output argumentIf a pointer argument is used to both pass and return data, then it must appear as both an input argument and an output argument.
For more information, see Define Missing Direction Property.
Dimensions of the array data, specified as a numeric vector, string vector, cell
array, or "nullTerminated". MATLAB uses this value to determine the
number of elements in the MATLAB data that can be allowed as input to a C++ pointer
argument. For example:
If
Size= 1, only inputs with one element are allowed.If
Size= 5, only an input vector with five elements is allowed.If
Size="len", an input vector with any number of elements is allowed. MATLAB determines the actual number of elements from the inputs when calling the function and passes it to the C++ function using the"len"parameter.If
Size=["m","n"], only a 2-D matrix input is allowed, but any number of elements are allowed for each dimension. MATLAB determines the actual number of elements from the inputs when calling the function and is passes them to the C++ function using the"m"and"n"parameters.If
Size="nullTerminated", only a MATLAB string is allowed.
This property is read-only.
Whether the argument requires additional definition, represented as
Complete or Incomplete.
Doxygen @brief comments for the argument from the header file,
specified as a string scalar. You can modify the description in this
InputArgumentDefinition object.
Object Functions
define | Define input argument in C++ library function or method |
Examples
To get argument information for calling a function, use the
CPPInputs and CPPOutput properties.
The add function adds two double values and returns the
result.
double add(double value1, double value2);Publish an interface MathLibrary containing
add.
fcn = findFunction(def,"add")fcn =
FunctionDefinition with properties:
CPPName: "add"
MATLABName: "clib.MathLibrary.add"
Overloaded: false
CPPSignature: "double add(double value1,double value2)"
MATLABSignature: RetVal = clib.MathLibrary.add(value1, value2)
CPPInputs: [1×2 clibgen.api.InputArgumentDefinition]
CPPOutput: [1×1 clibgen.api.OutputArgumentDefinition]
Status: Complete
Included: true
Show all properties
There are two input arguments.
fcn.CPPInputs
ans =
1×2 InputArgumentDefinition array with properties:
Name
Position
CPPType
MATLABType
Direction
Size
Status
Display as table
Click the Display as table link.
Name Position CPPType MATLABType Status ________ ________ ________ __________ ________ "value1" 1 "double" "double" Complete "value2" 2 "double" "double" Complete
There is one output argument.
fcn.CPPOutput
ans =
OutputArgumentDefinition with properties:
Name: "RetVal"
CPPType: "double"
MATLABType: "double"
Size: 1
Status: Complete
Each argument is fully defined:
C++
doublemaps directly to MATLABdouble.Each argument is scalar (
Size=1).Each input argument is input-only (
Direction = "input").
Display the MATLABType, Size, and
Direction properties in a table.
% Variable data for Argument n1 = fcn.CPPInputs(1).Name; n2 = fcn.CPPInputs(2).Name; n3 = fcn.CPPOutput.Name; Argument = [n1; n2; n3]; % Variable data for MATLABType t1 = fcn.CPPInputs(1).MATLABType; t2 = fcn.CPPInputs(2).MATLABType; t3 = fcn.CPPOutput.MATLABType; MATLABType = [t1; t2; t3]; % Variable data for Size s1 = fcn.CPPInputs(1).Size; s2 = fcn.CPPInputs(2).Size; s3 = fcn.CPPOutput.Size; Size = [s1; s2; s3]; % Variable data for Direction d1 = fcn.CPPInputs(1).Direction; d2 = fcn.CPPInputs(2).Direction; d3 = "n/a"; Direction = [d1; d2; d3]; T = table(Argument,MATLABType,Size,Direction)
T =
Argument MATLABType Size Direction
________ __________ ____ _________
"value1" "double" 1 "input"
"value2" "double" 1 "input"
"RetVal" "double" 1 "n/a"
In MATLAB, call clib.MathLibrary.add with a two double input
arguments.
fcn.MATLABSignature
ans =
"MATLAB signature for FunctionDefinition
Maps C++ signature:
double add(double value1,double value2)
to MATLAB as:
RetVal = clib.MathLibrary.add(value1, value2)
Input Arguments
value1 double
value2 double
Output Arguments
RetVal double
"
Version History
Introduced in R2026b
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Seleccione un país/idioma
Seleccione un país/idioma para obtener contenido traducido, si está disponible, y ver eventos y ofertas de productos y servicios locales. Según su ubicación geográfica, recomendamos que seleccione: .
También puede seleccionar uno de estos países/idiomas:
Cómo obtener el mejor rendimiento
Seleccione China (en idioma chino o inglés) para obtener el mejor rendimiento. Los sitios web de otros países no están optimizados para ser accedidos desde su ubicación geográfica.
América
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)