Documentation Center

  • Trial Software
  • Product Updates

outputs

Define component outputs, that is, Physical Signal output ports of block

Syntax

outputs out1 = { value , 'unit' };  end

Description

outputs begins a component outputs definition block, which is terminated by an end keyword. This block contains declarations for component outputs. Outputs will appear as Physical Signal output ports in the block diagram when the component file is brought into a Simscape™ model. Each output is defined as a value with unit, where value can be a scalar, vector, or matrix. For a vector or a matrix, all signals have the same unit.

Specifying an optional comment lets you control the port label and location in the block icon.

The following syntax defines a component output, out1, as a value with unit. value is the initial value. unit is a valid unit string, defined in the unit registry.

outputs
    out1 = { value , 'unit' };
end

You can specify the output port label and location, the way you want it to appear in the block diagram, as a comment:

outputs
    out1 = { value , 'unit' };  % label:location
end

where label is a string corresponding to the input port name in the block diagram, location is one of the following strings: left, right, top, bottom.

Examples

The following example declares an output port p, with a default value of 1 Pa, specifying the output port of a hydraulic pressure sensor. In the block diagram, this port will be named Pressure and will be located on the bottom side of the block icon.

outputs
    p = { 1 'Pa' };   % Pressure:bottom
end

The next example declares an output port v as a 3-by-3 matrix of linear velocities.

 outputs
   v = {zeros(3), 'm/s'}; 
 end

See Also

inputs

nodes

Was this topic helpful?