Specify String Scalar Inputs at the Command Line
You can define string scalar inputs at the command line.
Programmatic specification of string scalar input types by using preconditioning
(assert
statements) is not supported.
To define string scalar inputs at the command line, use one of these procedures:
Alternatively, if you have a test file that calls your entry-point function with
example inputs, you can determine the input types by using
coder.getArgTypes
.
Provide an Example String Scalar Input
To provide an example string scalar to
fiaccel
, use the -args
option:
fiaccel myFunction -args {"Hello, world"}
Provide a String Scalar Type
To provide a type for a string scalar to fiaccel
:
Define a string scalar. For example:
s = "mystring";
Create a type from
s
.t = coder.typeof(s);
Pass the type to
fiaccel
by using the-args
option.fiaccel myFunction -args {t}
Provide a Constant String Scalar Input
To specify that a string scalar input is constant, use
coder.Constant
with the -args
option:
fiaccel myFunction -args {coder.Constant("Hello, world")}
Provide a Variable-Size String Scalar Input
To specify that a string scalar input has a variable-size:
Define a string scalar. For example:
s = "mystring";
Create a type from
s
.t = coder.typeof(s);
Assign the
StringLength
property of the type the upper bound of the string length and setVariableStringLength
totrue
. For example, specify that typet
is variable-size with an upper bound of 10.t.StringLength = 10; t.VariableStringLength = true;
To specify that
t
is variable-size with no upper bound:This automatically sets thet.StringLength = Inf;
VariableStringLength
property totrue
.Pass the type to
fiaccel
by using the-args
option.fiaccel myFunction -args {t}