Main Content

MultiStateImage

Display image reflecting input value

  • MultiStateImage block

Libraries:
Simulink / Dashboard

Description

The MultiStateImage block displays an image to indicate the value of the input signal. You can use the MultiStateImage block with other Dashboard blocks to build an interactive dashboard of controls and indicators for your model. You can specify pairs of input values and images to provide the information you want during simulation.

Connect Dashboard Blocks

Dashboard blocks do not use ports to connect to model elements. To connect dashboard blocks to signals in your model, use connect mode. Connect mode facilitates the process of connecting dashboard blocks in your model, especially when you want to connect multiple blocks at once. To connect a single dashboard block, you can also use the Connection table in the block dialog box.

Tip

You can modify dashboard block connections during normal and accelerator mode simulations.

To enter connect mode, in the canvas, select the dashboard block to connect. On the Simulink® Toolstrip, a tab named after the type of the selected block appears. On the block tab, click Connect. In connect mode, when you select one or more signals or blocks, a list of signals that are available for connection appears. Select a signal from the list to connect to the selected dashboard block. To connect another dashboard block, pause on the block you want to connect and click the Connect button above it. Then, select one or more signals and blocks in the model and choose a signal to connect.

A Gauge block is in connect mode. To the right of the Gauge block is a Sine Wave block that connects to a Gain block that connects to an Outport block. To the right of the Outport block is the list of signals available for connection.

When you finish connecting the dashboard blocks in your model, on the block tab, click Done Connecting.

Tip

You can hide the message shown on unconnected blocks using the set_param function with the ShowInitialText block parameter. The message also disappears when you connect the block.

Limitations

  • Except for the Dashboard Scope block and the Display block, dashboard blocks can only connect to real scalar signals.

  • The toolstrip does not support blocks that are inside a panel.

  • You cannot use the Connection table in the block dialog to connect a dashboard block to a block that is commented out. When you connect a dashboard block to a commented block using connect mode, the dashboard block does not display the connected value until the you uncomment the block.

  • Dashboard blocks cannot connect to model elements inside referenced models.

  • When you simulate a model hierarchy, dashboard blocks inside referenced models do not update.

  • Dashboard blocks do not support rapid accelerator simulation.

  • You cannot connect a dashboard block to state activity or chart data in Stateflow® during simulation.

  • You cannot programmatically connect a dashboard block to state activity or chart data in Stateflow.

  • Some signals do not have data available during simulation due to block reduction or optimization for accelerator mode simulations. To view such a signal using a dashboard block, mark the signal for logging.

Parameters

expand all

Use the connection table to select the signal to connect to the block. To connect the block to a signal:

  1. Make a selection in the model that includes one or more signals.

  2. In the table, select the signal you want to connect.

  3. Click Apply.

Tip

You can connect dashboard blocks to signals in the model during simulation.

Programmatic Use

Block Parameter: Binding
Type: Simulink.HMI.SignalSpecification
Default: []

Specify how to scale the image.

Fill with fixed Aspect Ratio scales the image to the size of the block while retaining its original aspect ratio.

Fixed displays the image with its fixed true size.

Fill adjusts the image to fill the block.

Programmatic Use

Block Parameter: ScaleMode
Type: string or character vector
Values: 'Fill with fixed aspect ratio' | 'Fixed' | 'Fill'
Default: 'Fill with fixed aspect ratio'

States match an image to display with a value of the connected variable or parameter. Each state consists of a State and an image, displayed as a Thumbnail in the States table for the MultiStateImage block.

  • State — Connected variable or parameter value that causes the MultiStateImage block to display the corresponding image.

  • Thumbnail — Image to display when the connected variable or parameter value matches the corresponding State.

Click the + button to add another state.

Programmatic Use

To programmatically configure State and Thumbnail parameter values for the MultiStateImage block, use the States parameter. Specify the value for the States parameter as an array of structures with the fields:

  • State — State value.

  • Size1-by-2 vector containing the width and height for the image in that order, in pixels, specified as a uint64.

  • Image — Character array of Base64 encoded image data.

  • Thumbnail — Character array of Base64 encoded image data for the thumbnail image to display in the States table in the block dialog.

Include a structure in the array for each state you want to specify for the block. In the example, the myBase64Image and myBase64Thumbnail variables contain character vectors of the Base64 image data for the block image and thumbnail..

state1.State = 1;
state1.Size = [uint64(400) uint64(400)];
state1.Image = myBase64Image;
state1.Thumbnail = myBase64Thumbnail;
state2.State = 2;
state2.Size = uint64(400) uint64(400)];
state1.Image = myBase64Image2;
state1.Thumbnail = myBase64Thumbnail2;
msiStates = [state1 state2];
Block Parameter: States
Type: structure array

The block displays the default image when the connected signal value does not correspond to any of the specified states. Specify the DefaultImage parameter as a structure containing the fields:

  • Size1-by-2 vector containing the width and height for the image in that order, in pixels, specified as uint64.

  • Image — Character array of Base64 encoded image data.

  • Thumbnail — Character array of Base64 encoded image data for the thumbnail image to display in the States table in the block dialog.

Block Parameter: DefaultImage
Type: structure

Position of the block label. When the block is connected to an element in the model, the label is the name of the connected element.

Programmatic Use

Block Parameter: LabelPosition
Type: character vector
Values: 'Top' | 'Bottom' | 'Hide'
Default: 'Top'

Block Characteristics

Data Types

Boolean | double | enumerated | fixed point | half | integer | single

Direct Feedthrough

no

Multidimensional Signals

no

Variable-Size Signals

no

Zero-Crossing Detection

no

Extended Capabilities

Version History

Introduced in R2016b