| Using Simulink | ![]() |
Displaying Sample Time Colors
Simulink can color code the blocks and lines in your model to indicate the sample rates at which the blocks operate.
| Color |
Use |
| Black |
Continuous blocks |
| Magenta |
Constant blocks |
| Yellow |
Hybrid (subsystems grouping blocks, Mux or Demux blocks grouping signals with varying sample times, Data Store Memory blocks updated and read by different tasks) |
| 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 fastest discrete sample time |
| Cyan |
Blocks in triggered subsystems |
| Gray |
Fixed in minor step |
To enable the sample time colors feature, select Sample Time Colors from the Format menu.
Simulink 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 Simulink assigns 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 toplevel model and in the models that it references (see Referencing Models). 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 toplevel 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.
| Specifying Colors Programmatically | Connecting Blocks | ![]() |
© 1994-2005 The MathWorks, Inc.