| Signal Processing Blockset™ | ![]() |
| On this page… |
|---|
Advantages of Using the Boolean Data Type Lists of Blocks Supporting Boolean Inputs or Outputs |
Many Signal Processing Blockset™ blocks accept or output logical signals. All such blocks support the Boolean data type at their appropriate ports:
All block input ports that accept logical signals support the Boolean data type.
The default data type of all outputs that are logical signals is Boolean. You can change this default setting and disable Boolean support as described in Effects of Enabling and Disabling Boolean Support.
Using the Boolean data type rather than floating-point data types speeds up simulations and results in smaller, faster generated C code. For more about generated code, see Code Generation in the Signal Processing Blockset Getting Started Guide.
The following blocks have reset ports that accept the Boolean data type:
| Counter | Minimum |
| Cumulative Product | N-Sample Enable |
| Cumulative Sum | N-Sample Switch |
| Delay | RMS |
| Histogram | Standard Deviation |
| Maximum | Variance |
| Mean |
The following blocks have input ports that accept the Boolean data type:
Some or all of the output ports of the following blocks support outputs with the Boolean data type:
By default, the Simulink® environment enables Boolean support. When you leave Boolean support enabled, all Boolean-supporting output ports always output the Boolean data type.
In some cases, you may want to override the Simulink default and disable Boolean support. For example, you may have a model that you created before Boolean support existed. Leaving the Boolean support enabled in this model may cause some blocks that used to output the double-precision data type to output the Boolean data type. If the introduction of the Boolean data type breaks your model, you can fix the problem by disabling Boolean support.
The following table describes the effects of enabling and disabling Boolean support. Note that when you disable Boolean support, some Boolean-supporting output ports output double-precision data.
| Type of Boolean-Supporting Output Port | Effect of Enabling Boolean Support (Default) | Effect of Disabling Boolean Support |
|---|---|---|
(For example, the Edge Detector block) | Output is always Boolean, regardless of the input data type. |
|
With a corresponding block parameter for setting output data type to Logical or Boolean (for example, in the N-Sample Enable block) | Output is always Boolean, regardless of whether you set the output port to Logical or Boolean. |
|
To disable Boolean data type support in a particular model, clear the Boolean-enabling configuration parameter in the model by completing the following:
In the model for which you want to enable Boolean data type support, from the Simulation menu, select Configuration Parameters. The Configuration Parameters dialog box opens.
The following figure illustrates the Configuration Parameters dialog box with the appropriate settings for signal processing simulations (note the discrete Fixed-step solver setting).

Open the Configuration Parameters dialog box. In the Select pane, click Optimization. Clear the Implement logic signals as boolean data (vs. double) check box. Click OK.
You have now disabled Boolean support in your model; for certain cases, output ports that support the Boolean data type will output double-precision data rather than Boolean data, as explained in Effects of Enabling and Disabling Boolean Support.

Check the data types of the signals in the model by turning on the automatic labeling of signal data types (see Viewing Data Types of Signals In Models). Some Boolean-supporting output ports might have output signals labeled double rather than boolean, depending on whether the inputs to the block are double-precision (see Effects of Enabling and Disabling Boolean Support).
If you do not see the data type labels after turning them on, you may have to refresh the model diagram by selecting the Edit menu in your model and then selecting Update diagram.
![]() | Viewing Data Types of Signals In Models | Working with Fixed-Point Data | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |