Simulink.SFunctionBuilder.add
Add input, output, parameter, library item, or state to S-Function Builder block
Since R2022a
Description
Simulink.SFunctionBuilder.add(
adds the element blk
,elem
,Name=Value
)elem
with options specified using one or more name-value
arguments to the S-Function Builder block blk
. For
example, to specify the data type for a port as double
, set
DataType
to double
.
The options you can specify depend on the type of element you add.
Input Arguments
blk
— S-Function Builder block
block handle | string | character vector
S-Function Builder block, specified as a block handle or as a string or a character vector that defines the block path.
Tips
To get the block handle for a block in your model, use the
getSimulinkBlockHandle
function.To get the block handle for the most recently selected or added block, use the
gcbh
function.
elem
— Type of element to add
'Input'
| 'Output'
| 'Parameter'
| 'LibraryItem'
| 'DiscreteState'
| 'ContinuousState'
Type of element to add, specified as one of these options:
'Input'
'Output'
'Parameter'
'LibraryItem'
'DiscreteState'
'ContinuousState'
Data Types: char
| string
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Before R2021a, use commas to separate each name and value, and enclose
Name
in quotes.
Example: Name="in1",DataType="single"
specifies options to configure
an input port with the name in1
and data type
single
.
Name
— Port or parameter name
string | character vector
Port or parameter name, specified as a string or a character vector. By default:
Input ports are named
u0
,u1
, …un
.Output ports are named
y0
,y1
, … ,yn
.Parameters are named
p0
,p1
, … ,pn
.
Specify the Name
name-value argument only when you add an input
port, an output port, or a parameter.
Example: Name="inputSignal"
Data Types: char
| string
DataType
— Port or parameter data type
'double'
(default) | 'single'
| 'boolean'
| 'int8'
| 'int16'
| 'int32'
| 'uint8'
| 'uint16'
| 'uint32'
| 'Fixdt:binary(a,b,c)'
| 'Fixdt:slope and bias(a,b,c,d)'
| 'Bus: <object name>'
Port or parameter data type, specified as one of these options:
'double'
'single'
'boolean'
'int8'
'int16'
'int32'
'uint8'
'uint16'
'uint32'
'Fixdt:binary(a,b,c)'
'Fixdt:slope and bias(a,b,c,d)'
'Bus: <object name>'
Parameters do not support fixed-point or bus data types.
Specify the DataType
name-value argument only when you add an
input port, an output port, or a parameter.
Example: DataType="single"
Data Types: char
| string
Complexity
— Port or parameter complexity
'real'
(default) | 'complex'
Port or parameter complexity, specified as 'real'
or
'complex'
.
Specify the Complexity
name-value argument only when you add an
input port, an output port, or a parameter.
Example: Complexity="complex"
Data Types: char
| string
Dimensions
— Input or output port dimensions
'[1,1]'
(default) | string | character vector
Input or output port dimensions, specified as a string or a character vector that defines the port dimensions as a scalar or vector.
Specify the Dimensions
name-value argument only when you add an
input or output port.
Example: Dimensions="2"
Example: Dimensions="[1,2]"
Data Types: char
| string
Unit
— Unit of input port, output port, or parameter
string | character vector
Unit specification for input port, output port, or parameter.
Example: Unit = 'm/s'
assigns the unit of the specified input,
output, or parameter as 'm/s'
Data Types: char
| string
Value
— Parameter value
1
(default) | string | character vector
Parameter value, specified as a string or a character vector that defines the value of the parameter.
Specify the Value
name-value argument only when you add a
parameter.
Example: Value="2"
specifies the parameter value as
2
.
Example: Value="[1 2]"
specifies the parameter value as
[1 2]
.
Data Types: char
| string
LibraryItemTag
— Tag for library item
'SRC_PATH'
(default) | 'LIB_PATH'
| 'INC_PATH'
| 'ENV_PATH'
| 'ENTRY'
Tag for library item, specified as one of these options:
'SRC_PATH'
— Object or library path'LIB_PATH'
— Include search path for header files and source files'INC_PATH'
— Search path for object files and source files'ENV_PATH'
— Environment variable'ENTRY'
— Object, source, or library file name or preprocessor directive, such as-DDEBUG
When you add a library item to an S-Function Builder block, use the
LibraryItemTag
and LibraryItemValue
name-value
arguments together to define the library item.
Specify the LibraryItemTag
name-value argument only when you
add a library item.
Example: LibraryItemTag="LIB_PATH",LibraryItemValue="$MATLABROOT\customobjs"
Data Types: char
| string
LibraryItemValue
— Library item value
string | character vector
Library item value, specified as a string or a character vector. The value you specify depends on the tag for the library item you add.
When you add a library item to an S-Function Builder block, use the
LibraryItemTag
and LibraryItemValue
name-value
arguments together to define the library item.
Example: LibraryItemTag="LIB_PATH",LibraryItemValue="$MATLABROOT\customobjs"
Data Types: char
| string
InitialCondition
— Initial condition for state
'0'
(default) | string | character vector
Initial condition for state, specified as a string or a character vector that defines the initial value for the state.
Specify the InitialCondition
name-value argument only when you
add a discrete or continuous state.
Example: InitialCondition="1"
specifies the initial condition
for the added state as 1
.
Data Types: char
| string
Version History
Introduced in R2022a
See Also
Blocks
Functions
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.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- 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)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)