Define component inputs, that is, Physical Signal input ports of block


inputs in1 = { value , 'unit' }; end  


inputs begins a component inputs definition block, which is terminated by an end keyword. This block contains declarations for component inputs. Inputs will appear as Physical Signal input ports in the block diagram when the component file is brought into a Simscape™ model. Each input 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 input, in1, as a value with unit. value is the initial value. unit is a valid unit string, defined in the unit registry.

    in1 = { value , 'unit' };

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

    in1 = { value , 'unit' };  % label:location

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.


The following example declares an input port s, with a default value of 1 Pa, specifying the control port of a hydraulic pressure source. In the block diagram, this port will be named Pressure and will be located on the top side of the block icon.

    s = { 1 'Pa' };   % Pressure:top

The next example declares an input port I as a row vector of electrical currents. The three signals have a default value of 1 A. The signal initial values may be different, but the unit has to be the same.

   I = { [1 1 1], 'A'}; 

See Also



Introduced in R2008b

Was this topic helpful?