| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Simulink |
| Contents | Index |
| Learn more about Simulink |
This class allows a Level-2 M-file S-function or other M program to obtain information about a block. Simulink software creates an instance of this class or a derived class for each block in a model. Simulink software passes the object to the callback methods of Level-2 M-file S-functions when it updates or simulates a model, allowing the callback methods to get block-related information from and provide such information to Simulink software. See Writing Level-2 M-File S-Functions in Writing S-Functions for more information. You can also use instances of this class in M-file programs to obtain information about blocks during a simulation. See Accessing Block Data During Simulation in the Simulink documentation for more information.
Note Simulink.RunTimeBlock objects do not support MATLAB sparse matrices. For example, the following line of code attempts to assign a sparse identity matrix to the run-time object's output port data. This line of code in a Level-2 M-file S-function produces an error: block.Outport(1).Data = speye(10); |
None
Name | Description |
|---|---|
Block's handle. | |
Current simulation time. | |
Number of discrete work vectors used by the block. | |
Number of block output ports. | |
Number of block's continuous states. | |
Number of block's discrete states | |
Number of parameters that can be entered on S-function block's dialog box. | |
Number of block's input ports. | |
Number of run-time parameters used by block. | |
Sample times at which block produces outputs. |
Name | Description |
|---|---|
Get a block's continuous states. | |
Determine whether a data type is fixed point. | |
Get name of a data type supported by this block. | |
Get size of a data type supported by this block. | |
Get a block's continuous state derivatives. | |
Get a parameter entered on an S-function block's dialog box. | |
Get one of a block's DWork vectors. | |
Determine the properties of a fixed-point data type. | |
Get one of a block's input ports. | |
Get one of a block's output ports. | |
Get one of the run-time parameters used by a block. |
Block's handle.
RO
Current simulation time.
RO
Number of data work vectors.
RW
Number of output ports.
RW
Number of continuous states.
RW
Number of discrete states. In an M-file S-function, you need to use DWorks to set up discrete states.
RW
Number of parameters declared on the block's dialog. In the case of the S-function, it returns the number of parameters listed as a comma-separated list in the S-function parameters dialog field.
RW
Number of input ports.
RW
Number of run-time parameters used by this block. See Run-Time Parameters for more information.
RW
Block's sample times.
RW for M-file S-functions, RO for all other blocks.
Get a block's continuous states.
states = ContStates();
Get vector of continuous states.
Determine whether a data type is fixed point.
bVal = DataTypeIsFixedPoint(dtID);
Returns true if the specified data type is a fixed-point data type.
Get the name of a data type.
name = DatatypeName(dtID);
Returns the name of the data type specified by dtID.
Get the size of a data type.
size = DatatypeSize(dtID);
Returns the size of the data type specified by dtID.
Get derivatives of a block's continuous states.
derivs = Derivatives();
Get vector of state derivatives.
Get an S-function's dialog parameters.
param = DialogPrm(pIdx);
Get the specified dialog parameter. In the case of the S-function, each DialogPrm corresponds to one of the elements in the comma-separated list of parameters in the S-function parameters dialog field.
Get one of a block's DWork vectors.
dworkObj = Dwork(dwIdx);
Get information about the DWork vector specified by dwIdx where dwIdx is the index number of the work vector. This method returns an object of type Simulink.BlockCompDworkData.
Get the properties of a fixed-point data type.
eno = FixedPointNumericType(dtID);
Returns an object of embedded.Numeric class that contains the attributes of the specified fixed-point data type.
Note embedded.Numeric is also the class of the numerictype objects created by Fixed-Point Toolbox software. For information on the properties defined by embedded.Numeric class, see numerictype Object Properties in the "Property Reference" in the Fixed-Point Toolbox User's Guide. |
Get an input port of a block.
port = InputPort(pIdx);
Get the input port specified by pIdx, where pIdx is the index number of the input port. For example,
port = rto.InputPort(1)
returns the first input port of the block represented by the run-time object rto.
This method returns an object of type Simulink.BlockPreCompInputPortData or Simulink.BlockCompInputPortData, depending on whether the model that contains the port is uncompiled or compiled. You can use this object to get and set the input port's uncompiled or compiled properties, respectively.
ssGetInputPortSignalPtrs, Simulink.BlockPreCompInputPortData, Simulink.BlockCompInputPortData, OutputPort
Get an output port of a block.
port = OutputPort(pIdx);
Get the output port specified by pIdx, where pIdx is the index number of the output port. For example,
port = rto.InputPort(1)
returns the first output port of the block represented by the run-time object rto.
This method returns an object of type Simulink.BlockPreCompOutputPortData or Simulink.BlockCompOutputPortData, depending on whether the model that contains the port is uncompiled or compiled, respectively. You can use this object to get and set the output port's uncompiled or compiled properties, respectively.
ssGetInputPortSignalPtrs, Simulink.BlockPreCompOutputPortData, Simulink.BlockCompOutputPortData
Get an S-function's run-time parameters.
param = RuntimePrm(pIdx);
Get the run-time parameter whose index is pIdx.
![]() | Simulink.ParamRTWInfo | Simulink.ScopeDataLogs | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |