Boolean Support

Advantages of Using the Boolean Data Type

Many Signal Processing Blockset™ blocks accept or output logical signals. All such blocks support the Boolean data type at their appropriate ports:

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.

Lists of Blocks Supporting Boolean Inputs or Outputs

The following blocks have reset ports that accept the Boolean data type:

CounterMinimum
Cumulative ProductN-Sample Enable
Cumulative SumN-Sample Switch
DelayRMS
HistogramStandard Deviation
MaximumVariance
Mean 

The following blocks have input ports that accept the Boolean data type:

BufferQueue
Check Signal AttributesRepeat
Convert 1-D to 2-DSample and Hold
Convert 2-D to 1-DSignal To Workspace
Create Diagonal MatrixSpectrum Scope
Delay LineStack
DownsampleSubmatrix
Extract Triangular MatrixTime Scope
FlipToeplitz
Frame ConversionTranspose
Identity MatrixTriggered To Workspace
Inherit ComplexityUnbuffer
Matrix ViewerUpsample
Multiport SelectorVariable Integer Delay
Overwrite ValuesVariable Selector
PadVector Scope
Permute Matrix 

Some or all of the output ports of the following blocks support outputs with the Boolean data type:

BufferMultiphase Clock
Check Signal AttributesMultiport Selector
Convert 1-D to 2-DN-Sample Enable
Convert 2-D to 1-DOverwrite Values
CounterPad
Create Diagonal MatrixPermute Matrix
Delay LinePolynomial Stability Test
DownsampleQueue
Edge DetectorRepeat
Event-Count ComparatorSample and Hold
Extract DiagonalScalar Quantizer Encoder
Extract Triangular MatrixStack
FlipSubmatrix
Frame ConversionToeplitz
From Wave FileTranspose
Identity MatrixUnbuffer
Inherit ComplexityUpsample
LPC to/from RCVariable Integer Delay
LPC to LSF/LSP ConversionVariable Selector
LU Factorization 

Effects of Enabling and Disabling Boolean Support

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 PortEffect of Enabling Boolean Support (Default)Effect of Disabling Boolean Support
  • On a block with at least one input port

  • Did not support the Boolean data type in versions of Signal Processing Blockset software before Version 5.0

(For example, the Edge Detector block)

Output is always Boolean, regardless of the input data type.

  • When input is double precision, the output is also double precision.

  • When input is not double precision, the output is Boolean.

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.

  • When set to Logical, the output is double precision.

  • When set to Boolean, the output is Boolean.

Steps to Disabling Boolean Support

To disable Boolean data type support in a particular model, clear the Boolean-enabling configuration parameter in the model by completing the following:

Step 1: Open the Configuration Parameters Dialog Box

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).

Step 2: Disable the Boolean Data Type in the Advanced Tab

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.

Step 3: (Optional) Verify Data Types of Signals

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.

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS