| Contents | Index |
• Specifying Block Diagram Colors
Aligning, Distributing, and Resizing Groups of Blocks Automatically
Annotations Properties Dialog Box
Associating Click Functions with Annotations
Why Subsystems are Advantageous
Creating a Subsystem by Adding the Subsystem Block
Creating a Subsystem by Grouping Existing Blocks
Controlling Access to Subsystems
Hierarchical Symbol Resolution
Specifying Numeric Values with Symbols
• Consulting the Model Advisor
Overview of the Model Advisor Window
Reverting Changes Using Restore Points
Viewing and Saving Model Advisor Reports
Specifying Block-Based Sample Times Interactively
Specifying Port-Based Sample Times Interactively
Specifying Block-Based Sample Times Programmatically
Specifying Port-Based Sample Times Programmatically
Accessing Sample Time Information Programmatically
Specifying Sample Times for a Custom Block
Prepare the Model for Conversion
Connect the Model Block and Perform Other Post-Conversion Tasks
Specifying the Simulation Mode
Using Normal Mode for Multiple Instances of Referenced Models
Accelerating a Freestanding or Top Model
Simulation Target Output File Control
Parallel Building for Large Model Reference Hierarchies
Configuration Parameter Requirements
Working with Conditional Referenced Models
Generate Code for Conditional Models
Requirements for Conditional Models
Obtaining Object and Variable Names for a Protected Model
Conditions for Inheriting Sample Times
Determining Sample Time of a Referenced Model
Blocks That Depend on Absolute Time
Blocks Whose Outputs Depend on Inherited Sample Time
S-Functions with Accelerator Mode Referenced Models
Using C S-Functions in Normal Mode Referenced Models
Limitations on All Model Referencing
Limitations on Normal Mode Referenced Models
• Creating Conditional Subsystems
Blocks that an Enabled Subsystem Can Contain
Using Blocks with Constant Sample Times in Enabled Subsystems
What Are Triggered Subsystems?
Using Model Referencing Instead of a Triggered Subsystem
Creating a Triggered Subsystem
Blocks That a Triggered Subsystem Can Contain
Creating a Triggered and Enabled Subsystem
A Sample Triggered and Enabled Subsystem
Creating Alternately Executing Subsystems
Propagating Execution Contexts
Workflow for Implementing Variant Systems
Example of a Model Variants Block
Configuring the Model Variants Block
Disabling and Enabling Model Variants
Requirements, Limitations, and Tips for Model Variants
Example of a Variant Subsystem Block
Configuring the Variant Subsystem Block
Disabling and Enabling Subsystem Variants
Variant Subsystem Block Requirements
Example Variant Control Variables
Using Enumerated Types for Variant Control Variable Values
Selecting the Active Variant for Simulation
• Exploring, Searching, and Browsing Models
Introduction to the Model Explorer
Customizing the Model Explorer Interface
Basic Steps for Using the Model Explorer
Focusing on Specific Elements of a Model or Chart
What You Can Do with the Model Hierarchy Pane
Displaying Linked Library Subsystems
Linked Library and Masked Subsystems
Navigating to the Block Diagram
Working with Configuration Sets
Cutting, Copying, and Pasting Objects
Data Displayed in the Contents Pane
Link to the Currently Selected Node
Horizontal Scrolling in the Object Property Table
Working with the Contents Pane
Changing the Order of Property Columns
Hiding or Removing Property Columns
Marking Nonexistent Properties
Finding Blocks That Use a Specific Variable
Finding Unused Workspace Variables
Showing and Hiding the Search Bar
Showing and Hiding the Dialog Pane
Editing Properties in the Dialog Pane
Opening the Model Dependency Viewer
Manipulating a Dependency View
Highlighting Requirements in a Model
Viewing Information About a Requirements Link
• Managing Model Configurations
Create a Configuration Set in a Model
Create a Configuration Set in the Base Workspace
Open a Configuration Set in the Configuration Parameters Dialog Box
Set Values in a Configuration Set
Copy, Delete, and Move a Configuration Set
Load a Saved Configuration Set
Copy Configuration Set Components
Create and Attach a Configuration Reference
Resolve a Configuration Reference
Activate a Configuration Reference
Change Parameter Values in a Referenced Configuration Set
Save a Referenced Configuration Set
Load a Saved Referenced Configuration Set
Why is the Build Button Not Available for a Configuration Reference?
What Is a Freestanding Configuration Set?
Model Configuration Preferences
Why Use Configuration References?
Unresolved Configuration References
Configuration Reference Limitations
Configuration References for Models with Older Simulation Target Settings
Load and Activate a Configuration Set at the Command Line
Save a Configuration Set at the Command Line
Create a Freestanding Configuration Set at the Command Line
Create and Attach a Configuration Reference at the Command Line
Attach a Configuration Reference to Multiple Models at the Command Line
Get Values from a Referenced Configuration Set
Change Values in a Referenced Configuration Set
• Configuring Models for Targets with Multicore Processors
Tools for Managing Project Files
Getting Started with Your Project
Create a New Project to Manage Existing Files
Change the Project Name, Root, Description, and Startup Folder
Use Shortcuts to Find and Run Frequent Tasks
Automate Startup Tasks with Shortcuts
Automate Shutdown Tasks with Shortcuts
Register Model Files with Source Control Tools
Add or Change Project Source Control
Write a Source Control Adapter with the SDK
Check Source Control Status of Project Files
Create a Template from Your Current Project
Create a New Project Using a Template
Command-Line Dependency Analysis
Pausing or Stopping a Simulation
Using Blocks to Stop or Pause a Simulation
Choosing a Variable-Step Solver
Choosing a Jacobian Method for an Implicit Solver
How to Change the States of a Block within the SimState
Using the SimState Interface Checksum Diagnostic
Using SimState within S-Functions
Creating Custom Simulation Error Messages
Examples of Implementing the sim Command
Calling sim from within parfor
sim in parfor with Rapid Accelerator Mode
Resolving Workspace Access Issues
Resolving Data Concurrency Issues
Methods of the MSLException Class
Capturing Information about the Error
Scope Block and Scope Signal Viewer Differences
Why Use Signal Generators and Signal Viewers Instead of Source Blocks and Scope Blocks?
Adding Signals to a Signal Viewer
How to Save Data to MATLAB Workspace
Creating a Multiple Axes Scope Signal Viewer
Scope Signal Viewer Context Menu
Scope Signal Viewer Parameters Dialog Box
How a Scope Signal Viewer Determines Trace Color Coding and Line Styles
How Scope Signal Viewer Parameter Settings Can Affect Performance
Opening the Signal and Scope Manager
Changing Generator or Viewer Parameters
Removing a Generator or Viewer from a Simulink Model
Record or Import Data into the Simulation Data Inspector Tool
Visual Inspection of Signal Data in the Simulation Data Inspector Tool
Comparison of One Signal From Multiple Simulations
Comparison of All Logged Signal Data From Multiple Simulations
Create Simulation Data Inspector Report
Export Results in the Simulation Data Inspector Tool
How the Simulation Data Inspector Tool Aligns Signals
How the Simulation Data Inspector Tool Compares Time Series Data
Understanding the Simulation Data Inspector Interface
Limitations of the Simulation Data Inspector Tool
Record and Inspect Signal Data Programmatically
Using the Simulation Data Inspector Tool
Linearization with Referenced Models
Linearization Using the 'v5' Algorithm
Accessing the MATLAB Workspace
Starting from the Command Window
Setting Unconditional Breakpoints
Setting Conditional Breakpoints
Displaying Algebraic Loop Information
Determining If the Simulation Will Rebuild
Selecting Blocks for Rapid Accelerator Mode
Controlling S-Function Execution
Accelerator and Rapid Accelerator Mode Data Type Considerations
Behavior of Scopes and Viewers with Rapid Accelerator Mode
Factors Inhibiting Acceleration
Running Acceleration Mode from the User Interface
Building Accelerator Mode MEX-files
Customizing the Acceleration Build Process
Adding Blocks by Browsing or Searching with the Library Browser
Adding Blocks Programmatically
Copying and Moving Blocks from One Window to Another
Creating Block Annotations Programmatically
Displaying Parameters Beneath a Block
Setting Port Value Data Tip Options
Controlling the Port Value Display
Displayed Value When No Data Is Available
Port Value Display Limitations
How Simulink Determines the Sorted Order
Listening for Method Execution Events
Synchronizing Run-Time Objects and Simulink Execution
Using Workspace Variables in Parameter Expressions
Resolving Variable References in Block Parameter Expressions
Using Parameter Objects to Specify Parameter Values
Determining Parameter Data Types
Blocks That Perform Parameter Range Checking
Specifying Ranges for Parameters
Performing Parameter Range Checking
Specifying Some Parameters as Noninline
Referencing Structure Parameters
Parameter Structure Limitations
Data Set Numeric and Data Types
Summary of Lookup Table Block Features
Entering Data in the Lookup Table Editor
Entering Data Using Inports of the Lookup Table Dynamic Block
Monotonicity of Breakpoint Data Sets
Representation of Discontinuities in Lookup Tables
Formulation of Evenly Spaced Breakpoints
Example Output for Lookup Methods
Layout of the Lookup Table Editor
Working with Table Data of Standard Format
Working with Table Data of Nonstandard Format
Importing Data from an Excel Spreadsheet
Adding and Removing Rows and Columns in a Table
Displaying N-Dimensional Tables in the Editor
Editing Custom Lookup Table Blocks
Optimize Breakpoint Spacing in Lookup Tables
Compatibility of Models with Older Versions of Lookup Table Blocks
What to Expect from the Model Advisor Check
Masking a Block for Inclusion in a User Library
Masking a Block that Resides in a User Library
Masking a Block Copied from a User Library
Promoting Block Parameters to the Mask
Creating a Simplified Custom Interface for a Built-In Block
Creating a Simplified Custom Interface for Multiple Parameters in a Subsystem
Rules for Promoting Parameters
Predefined Masked Dialog Box Parameters
Notes on Mask Parameter Storage
Setting Masked Block Dialog Box Parameters
Setting Nested Masked Block Parameters
Creating Self-Modifying Masks for Library Blocks
Initialization Command Execution
Mask Parameters Dialog Box Callback Code Execution
Speed and Code Generation Requirements
Defining Custom Block Behavior
Deciding on a Custom Block Type
Placing Custom Blocks in a Library
Adding a Graphical User Interface to a Custom Block
Adding Block Functionality Using Block Callbacks
Creating Custom Blocks from MATLAB Functions
Creating Custom Blocks from S-Functions
Finding a Linked Block's Prototype
Finding Linked Blocks in a Model
Locking Links to Blocks in a Library
Disabling Links to Library Blocks
Restoring Disabled or Parameterized Links
Checking and Setting Link Status Programmatically
Breaking a Link to a Library Block
Fixing Unresolved Library Links
Modifying and Locking Libraries
Making Backward-Compatible Changes to Libraries
Example of a Minimal slblocks.m File
Adding More Descriptive Information in slblocks.m
Why Use MATLAB Function Blocks?
Programming the MATLAB Function Block
Building the Function and Checking for Errors
Enabling and Disabling Debugging
Debugging the Function in Simulation
Watching Function Variables During Simulation
Checking for Data Range Violations
MATLAB Function Block Editor Tools
Editing and Debugging MATLAB Function Block Code
Location of MATLAB Function Reports
Opening MATLAB Function Reports
Description of MATLAB Function Reports
Viewing Your MATLAB Function Code
Viewing Call Stack Information
Viewing the Compilation Summary Information
Viewing Error and Warning Messages
Viewing Variables in Your MATLAB Code
Keyboard Shortcuts for the MATLAB Function Report
Inheriting Argument Data Types
Built-In Data Types for Arguments
Specifying Argument Types with Expressions
Specifying Simulink Fixed Point Data Properties
Inheriting Argument Sizes from Simulink
Specifying Argument Sizes with Expressions
Eliminating Warnings for Implicit Signal Resolution in the Model
Disabling Implicit Signal Resolution for a MATLAB Function Block
Forcing Explicit Signal Resolution for an Output Data Signal
Example of Structures in a MATLAB Function Block
How Structure Inputs and Outputs Interface with Bus Signals
Rules for Defining Structures in MATLAB Function Blocks
Workflow for Creating Structures in MATLAB Function Blocks
Indexing Substructures and Fields
Assigning Values to Structures and Fields
Working with Structure Parameters in MATLAB Function Blocks
Limitations of Structures and Buses in MATLAB Function Blocks
How MATLAB Function Blocks Implement Variable-Size Data
Enabling Support for Variable-Size Data
Declaring Variable-Size Inputs and Outputs
Declaring Variable-Size Data Locally
Simple Example: Defining and Using Variable-Size Data in MATLAB Function Blocks
Simple Example: Defining and Using Enumerated Types in MATLAB Function Blocks
Using Enumerated Data in MATLAB Function Blocks
How to Define Enumerated Data Types for MATLAB Function Blocks
How to Add Enumerated Data to MATLAB Function Blocks
How to Instantiate Enumerated Data in MATLAB Function Blocks
Limitations of Enumerated Types
Using Global Data with the MATLAB Function Block
Choosing How to Store Global Data
How to Use Data Store Memory Blocks
How to Use Simulink.Signal Objects
Using Data Store Diagnostics to Detect Memory Access Issues
Limitations of Using Shared Data in MATLAB Function Blocks
Supported Types for Frame-Based Data
Adding Frame-Based Data in MATLAB Function Blocks
Examples of Frame-Based Signals in MATLAB Function Blocks
How to Create Custom MATLAB Function Block Libraries
Example: Creating a Custom Signal Processing Filter Block Library
Code Reuse with Library Blocks
Debugging MATLAB Function Library Blocks
Properties You Can Specialize Across Instances of Library Blocks
Basic Workflow for Using Traceability
Tutorial: Using Traceability in a MATLAB Function Block
Location of Comments in Generated Code
Including MATLAB Function Help Text in the Function Banner
Limitations of MATLAB Source Code as Comments
Converting If-Elseif-Else Code to Switch-Case Statements
Example of Converting Code for If-Elseif-Else Decision Logic to Switch-Case Statements
When to Disable BLAS Library Support
How to Disable BLAS Library Support
When to Disable Run-Time Checks
How to Disable Run-Time Checks
Data Types Supported by Simulink
Block Support for Data and Numeric Signal Types
Creating Signals of a Specific Data Type
Specifying Block Output Data Types
Validating a Floating-Point Embedded Model
Tutorial: Validating a Single-Precision Model
Using the Model Explorer to Create Data Objects
Saving and Loading Data Objects
Using Data Objects in Simulink Models
Creating Persistent Data Objects
Disadvantages of Level-1 Data Class Infrastructure
Features of Level-2 Data Class Infrastructure
Other Differences between Level-1 and Level-2 Data Classes
Enabling Custom Storage Classes
Valid Values for Design Minimum and Maximum
Creating a Simulink Enumeration Class
Customizing a Simulink Enumeration
Saving an Enumeration in a MATLAB File
Changing and Reloading Enumerations
Importing Enumerations Defined Externally to MATLAB
Specifying Enumerations as Data Types
Getting Information About Enumerations
Enumerated Values in Computation
Enumerated Types for Switch Blocks
Approaches for Exporting Signal Data
Enabling Simulation Data Export
Viewing Logged Simulation Data With the Simulation Data Inspector
Data Format for Model-Based Exported Data
Producing Specified Output Only
Limiting the Data Logged for a Signal
Using the Model Editor to View the Signal Logging Configuration
Using the Signal Logging Selector to View the Signal Logging Configuration
Using the Model Explorer to View the Signal Logging Configuration
Specifying the Signal Logging Data Format
Specifying a Name for the Signal Logging Data
Two Interfaces for Overriding Signal Logging Settings
Scope of Signal Logging Setting Overrides
Command-Line Interface for Overriding Signal Logging Settings
Viewing Logged Signal Data with the Simulation Data Inspector
Programmatically Accessing Logged Signal Data Saved in Dataset Format
Programmatically Accessing Logged Signal Data Saved in ModelDataLogs Format
Guidelines for Specifying Time and Signal Values for Imported Data
Example of Importing Data to Model a Continuous Plant
Example of Importing Data to Test a Discrete Algorithm
Using a From Workspace Block to Import an Input Test Case
Using a Signal Builder Block to Import an Input Test Case
Models with Multiple Root Inport Blocks
When to Use a Structure of MATLAB timeseries Objects Instead of a Simulink.TsArray Object
How to Use a Structure of MATLAB timeseries Objects to Import Bus Signals
Specifying the Input Expression
One Structure for All Ports or a Structure for Each Port
Examples of Specifying Signal and Time Data
Importing and Exporting State Information for Referenced Models
Workflow for Configuring Data Stores
Using Data Stores with Buses and Arrays of Buses
Specifying Data Store Memory Block Attributes
Specifying Signal Object Data Store Attributes
Accessing Specific Bus and Matrix Elements
Supported Data Types, Dimensions, and Complexity for Logging Data Stores
Data Store Logging Limitations
Logging Data Stores Created with a Data Store Memory Block
Logging Icon for the Data Store Memory Block
Logging Data Stores Created with a Simulink.Signal Object
Accessing Data Store Logging Data
Ordering Access Using Function Call Subsystems
Ordering Access Using Block Priorities
Detecting Multitasking Access Errors
Signal Dimensions, Size, and Width
Displaying Signal Values in Model Diagrams
Propagated Signal Label Format
Blocks That Support Signal Label Propagation
Display Propagated Signal Labels
How Simulink Propagates Signal Labels
Simulink Blocks that Support Multidimensional Signals
Determining the Output Dimensions of Source Blocks
Determining the Output Dimensions of Nonsource Blocks
Signal and Parameter Dimension Rules
Scalar Expansion of Inputs and Parameters
Highlighting Signal Destinations
Resolving Incomplete Highlighting to Library Blocks
Blocks That Allow Signal Range Specification
Checking for Signal Range Errors
Using Block Parameters to Initialize Signals and Discrete States
Using Signal Objects to Initialize Signals and Discrete States
Using Signal Objects to Tune Initial Values
Example: Using a Signal Object to Initialize a Subsystem Output
Initialization Behavior Summary for Signal Objects
Designating a Signal as a Test Point
Displaying Test Point Indicators
Printing, Exporting, and Copying Waveforms
Associating Bus Objects with Simulink Blocks
Writing a Bus Object Import Function
Writing a Bus Object Export Function
Connecting Buses to Root Level Outports
Connecting Buses to Nonvirtual Inports
Connecting Buses to Model, Stateflow, and MATLAB Function Blocks
Connecting Multi-Rate Buses to Referenced Models
Creating Initial Condition (IC) Structures
Three Ways to Initialize Bus Signals Using Block Parameters
Setting Diagnostics to Support Bus Signal Initialization
Blocks That Support Arrays of Buses
Using an Array of Buses in a Model
Generated Code for an Array of Buses
Converting a Model to Use an Array of Buses
Using Diagnostics for Mux/Bus Mixtures
Using the Model Advisor for Mux/Bus Mixtures
Correcting Buses Used as Muxes
Bus to Vector Block Compatibility Issues
Avoiding Mux/Bus Mixtures When Developing Models
Creating Variable-Size Signals
How Variable-Size Signals Propagate
Subsystem Initialization of Variable-Size Signals
Demo of Variable-Size Signal Length Adaptation
Demo of Mode-Dependent Variable-Size Signals
Demo of C S-Function with Variable-Size Signals
• Customizing Simulink Environment and Printed Models
About Adding Items to the Model Editor Menus
Registering Menu Customizations
Debugging Custom Menu Callbacks
About Disabling and Hiding Model Editor Menu Items
Example: Disabling the New Model Command on the Simulink Editor's File Menu
About Disabling and Hiding Controls
Example: Disabling a Button on a Simulink Dialog Box
Writing Control Customization Callback Functions
Registering Control Customization Callback Functions
Disabling and Hiding Libraries
Customizing the Library Browser's Menu
Starting the PrintFrame Editor
Getting Help for the PrintFrame Editor
Variable and Static Information
Single Use or Multiple Use Print Frames
• Running Models on Target Hardware
Passing Parameters to S-Functions
Mathematics of Simulink Blocks
Setting Sample Times and Offsets
Level-2 MATLAB S-Function Examples
Level-1 MATLAB S-Function Examples
Using a Hand-Written S-Function to Incorporate Legacy Code
Using the S-Function Builder to Incorporate Legacy Code
Using the Legacy Code Tool to Incorporate Legacy Code
Level-2 MATLAB S-Function Template
Level-2 MATLAB S-Function Callback Methods
Example of Writing a Level-2 MATLAB S-Function
Instantiating a Level-2 MATLAB S-Function
Operations for Variable-Size Signals
Generating Code from a Level-2 MATLAB S-Function
Level-1 MATLAB S-Function Arguments
Level-1 MATLAB S-Function Outputs
Defining S-Function Block Characteristics
Processing S-Function Parameters
Converting Level-1 MATLAB S-Functions to Level-2
Deploying the Generated S-Function
How the S-Function Builder Builds an S-Function
Parameters/S-Function Name Pane
Example: Modeling a Two-Input/Two-Output System
Callback Method Implementations
Simulink/Simulink Coder Interfaces
S-Function Source File Requirements
Example of Integrating Existing C Functions into Simulink Models with the Legacy Code Tool
Registering Legacy Code Tool Data Structures
Declaring Legacy Code Tool Function Specifications
Generating and Compiling the S-Functions
Generating a Masked S-Function Block for Calling a Generated S-Function
Forcing Simulink Accelerator Mode to Use S-Function TLC Inlining Code
Handling Multiple Registration Files
Deploying Generated S-Functions
Debugging C MEX S-Functions in the Simulink Environment
Debugging C MEX S-Functions Using Third-Party Software
Example of a Level-1 Fortran S-Function
Inline Code Generation Example
Example C MEX S-Function Calling Fortran Code
DWork Vectors and the Simulink Engine
DWork Vectors and the Simulink Coder Product
Using DWork Vectors in Level-2 MATLAB S-Functions
Using DWork Vectors With Legacy Code
Level-2 MATLAB S-Function DWork Vector
Elementary Work Vector Examples
Creating Input Ports for Level-2 MATLAB S-Functions
Creating Output Ports for C S-Functions
Creating Output Ports for Level-2 MATLAB S-Functions
Using Custom Data Types in Level-2 MATLAB S-Functions
Specifying Port-Based Sample Times
Hybrid Block-Based and Port-Based Sample Times
Multirate S-Functions and Sample Time Hit Calculations
Synchronizing Multirate S-Function Blocks
Specifying Model Reference Sample Time Inheritance
SimState Compliance Specification for C-MEX S-Functions
Using Frame-Based Signals in C S-Functions
Using Frame-Based Signals in Level-2 MATLAB S-Functions
ssSetErrorStatus Termination Criteria
• Blocks
| On this page… |
|---|
How to Specify Block Diagram Colors |
You can specify the foreground and background colors of any block or annotation in a diagram, as well as the diagram's background color. To set the background color of a block diagram, select Screen color from the Format menu. To set the background color of a block or annotation or group of such items, first select the item or items. Then select Background color from the Format menu. To set the foreground color of a block or annotation, first select the item. Then select Foreground color from the Format menu.
In all cases, a menu of color choices is displayed. Choose the desired color from the menu. If you select a color other than Custom, the background or foreground color of the diagram or diagram element is changed to the selected color.
If you choose Custom, The Simulink Choose Custom Color dialog box is displayed.

The dialog box displays a palette of basic colors and a palette of custom colors that you previously defined. If you have not previously created any custom colors, the custom color palette is all white. To choose a color from either palette, click the color, and then click the OK button.
To define a custom color, click the Define Custom Colors button on the Choose Custom Color dialog box.
The dialog box expands to display a custom color definer.

The color definer allows you to specify a custom color by
Entering the red, green, and blue components of the color as values between 0 (darkest) and 255 (brightest)
Entering hue, saturation, and luminescence components of the color as values in the range 0 to 255
Moving the hue-saturation cursor to select the hue and saturation of the desired color and the luminescence cursor to select the luminescence of the desired color
The color that you have defined in any of these ways appears in the Color|Solid box. To redefine a color in the Custom colors palette, select the color and define a new color, using the color definer. Then click the Add to Custom Colors button on the color definer.
You can use the set_param command at the MATLAB command line or in a MATLAB program to set parameters that determine the background color of a diagram and the background color and foreground color of diagram elements. The following table summarizes the parameters that control block diagram colors.
| Parameter | Determines |
|---|---|
ScreenColor | Background color of block diagram |
BackgroundColor | Background color of blocks and annotations |
ForegroundColor | Foreground color of blocks and annotations |
You can set these parameters to any of the following values:
'black', 'white', 'red', 'green', 'blue', 'cyan', 'magenta', 'yellow', 'gray', 'lightBlue', 'orange', 'darkGreen'
'[r,g,b]'
where r, g, and b are the red, green, and blue components of the color normalized to the range 0.0 to 1.0.
For example, the following command sets the background color of the currently selected system or subsystem to a light green color:
set_param(gcs, 'ScreenColor', '[0.3, 0.9, 0.5]')
The blocks and lines in your model can be color coded to indicate the sample rates at which the blocks operate.
| Color | Use |
|---|---|
Black | Continuous sample time |
Magenta | Constant sample time |
Red | Fastest discrete sample time |
Green | Second fastest discrete sample time |
Blue | Third fastest discrete sample time |
Light Blue | Fourth fastest discrete sample time |
Dark Green | Fifth fastest discrete sample time |
Orange | Sixth, seventh, eighth, etc., fastest discrete sample time |
Yellow | Indicates a block with hybrid sample time, e.g., subsystems grouping blocks and Mux or Demux blocks grouping signals with different sample times, Data Store Memory blocks updated and read by different tasks. |
Cyan | Blocks in triggered subsystems |
Brown | Variable sample time. See the Pulse Generator block and How to Specify the Sample Time for more information |
Gray | Fixed in minor step |
To enable the sample time colors feature, select Sample Time Colors from the Format menu.
The Simulink software does not automatically recolor the model with each change you make to it, so you must select Update Diagram from the Edit menu to explicitly update the model coloration. To return to your original coloring, disable sample time coloration by again choosing Sample Time Colors.
The color that is assigned to each block depends on its sample time relative to other sample times in the model. This means that the same sample time may be assigned different colors in a parent model and in models that it references. (See Referencing a Model.)
For example, suppose that a model defines three sample times: 1, 2, and 3. Further, suppose that it references a model that defines two sample times: 2 and 3. In this case, blocks operating at the 2 sample rate appear as green in the parent model and as red in the referenced model.
It is important to note that Mux and Demux blocks are simply grouping operators; signals passing through them retain their timing information. For this reason, the lines emanating from a Demux block can have different colors if they are driven by sources having different sample times. In this case, the Mux and Demux blocks are color coded as hybrids (yellow) to indicate that they handle signals with multiple rates.
Similarly, Subsystem blocks that contain blocks with differing sample times are also colored as hybrids, because there is no single rate associated with them. If all the blocks within a subsystem run at a single rate, the Subsystem block is colored according to that rate.
![]() | Selecting Objects | Connecting Blocks | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |


