主要内容

Manual Switch

Switch between two inputs

  • 库:
  • 金宝appSimulink /信号路由

  • Manual Switch block

Description

TheManual Switchblock is a toggle switch that selects one of its two inputs to pass through to the output. To toggle between inputs, double-click the block. You control the signal flow by setting the switch before you start the simulation or by changing the switch while the simulation is executing. TheManual Switchblock retains its current state when you save the model.

To programmatically toggle the switch, set theset_paramswproperty to'0'要么'1'. For example, to connect the second input to the output:

set_param(gcb,'sw','0')

要将第一个输入连接到输出:

set_param(gcb,'sw','1')

Note

Double-clicking theManual Switchblock does not open the block dialog box. Instead, it toggles the input choice.

Ports

输入

expand all

First of two inputs to theManual Switchblock. The block propagates the selected input to the output. To select the input signal, toggle the switch by double-clicking the block.

Data Types:single|double|一半|int8|INT16|int32|int64|uint8|uint16|uint32|uint64|Boolean|固定点|枚举|bus

Second of two inputs to theManual Switchblock. The block propagates the selected input to the output. To select the input signal, toggle the switch by double-clicking the block.

Data Types:single|double|一半|int8|INT16|int32|int64|uint8|uint16|uint32|uint64|Boolean|固定点|枚举|bus

Output

expand all

Output signal propagated from either the first or second input signal.

Data Types:single|double|一半|int8|INT16|int32|int64|uint8|uint16|uint32|uint64|Boolean|固定点|枚举|bus

Parameters

expand all

要查看块参数,请右键单击块并选择Block Parameters (ManualSwitch).

Select this check box to allow inputs with different sizes and propagate the selected input signal size to the output signal. If you clear the box, the block expands scalar inputs to have the same dimensions as nonscalar inputs. SeeScalar Expansion of Inputs and Parameters.

Programmatic Use

范围:varsize
Type:character vector
Value:'on'|'off'
Default:'off'

将采样时间指定为以外的值-1. For more information, seeSpecify Sample Time.

Dependencies

除非明确设置为除此之外的值,否则此参数不可见。-1. To learn more, seeBlocks for Which Sample Time Is Not Recommended.

Programmatic Use

Block Parameter:SampleTime
Type:string scalar or character vector
Default:“-1”

块特征

Data Types

Boolean|bus|double|枚举|固定点|一半|整数|single|string

直接喂养

yes

Multidimensional Signals

yes

Variable-Size Signals

yes

Zero-Crossing Detection

Extended Capabilities

Fixed-Point Conversion
使用固定点设计器™设计和模拟定点系统。

版本历史

在R2006A之前介绍