simulink.sampletimecolors.getPalette
Description
Examples
Use simulink.sampletimecolors.getPalette
to View and Use Different Palettes
Create a custom color palette object with the name
myFirstPalette
.pltObj = simulink.sampletimecolors.Palette('myFirstPalette') Palette with properties: Name: "myFirstPalette" ContinuousSampleTimeColors: [0 0 0] FixedInMinorStepSampleTimeColors: [0.4902 0.4902 0.4902] ContinuousVariableSampleTimeColors: [0.4902 0.4902 0.4902] DiscreteSampleTimeColors: [3x3 double] AsynchronousSampleTimeColors: [0.7529 0.3608 0.9843] AperiodicPartitionColors: [0.7529 0.3608 0.9843] InitializeEventSampleTimeColors: [0.7961 0.5176 0.3647] TerminateEventSampleTimeColors: [0.7961 0.5176 0.3647] ResetEventSampleTimeColors: [0.7961 0.5176 0.3647] ReinitializeEventSampleTimeColors: [0.7961 0.5176 0.3647] ConstantSampleTimeColors: [0.8196 0.0157 0.5451] MultirateSampleTimeColors: [0.5451 0.4000 0.0235] UnionSampleTimeColors: [0.4039 0.2980 0.0235]
Customize colors for the discrete sample time and continuous sample time using RGB values.
mypalette.DiscreteSampleTimeColors = [0.9 0.2 0.4]; mypalette.ContinuousSampleTimeColors = [0.7 0.5 0.3]
List all existing palettes using the
simulink.sampletimecolors.getPalette
function with the'all'
option.listOfPalettes = simulink.sampletimecolors.getPalette('all') names = [listOfPalettes.Name]
names = 1×2 cell array {["myFirstPalette"]} {["default (built in)"]}
List the palette that is currently active using the
simulink.sampletimecolors.getPalette
function with the'active'
option.simulink.sampletimecolors.getPalette('active')
ans = Palette with properties: Name: "default (built in)" ContinuousSampleTimeColors: [0 0 0] FixedInMinorStepSampleTimeColors: [0.4902 0.4902 0.4902] ContinuousVariableSampleTimeColors: [0.4902 0.4902 0.4902] DiscreteSampleTimeColors: [3×3 double] AsynchronousSampleTimeColors: [0.7529 0.3608 0.9843] AperiodicPartitionColors: [0.7529 0.3608 0.9843] InitializeEventSampleTimeColors: [0.7961 0.5176 0.3647] TerminateEventSampleTimeColors: [0.7961 0.5176 0.3647] ResetEventSampleTimeColors: [0.7961 0.5176 0.3647] ReinitializeEventSampleTimeColors: [0.7961 0.5176 0.3647] ConstantSampleTimeColors: [0.8196 0.0157 0.5451] MultirateSampleTimeColors: [0.5451 0.4000 0.0235] UnionSampleTimeColors: [0.4039 0.2980 0.0235]
Apply the new custom palette to the current MATLAB® session.
simulink.sampletimecolors.applyPalette('myFirstPalette')
Input Arguments
option
— simulink.sampletimecolors.Palette
object or objects to get
'active'
(default) | 'all'
| 'UserDefault'
simulink.sampletimecolors.Palette
object or objects to get,
specified as 'all'
, 'active'
, or
'UserDefault'
.
all
– Get a list of all the palette objects available.active
– Get the currently active palette object.UserDefault
– Get the palette object that is set as a default palette in preferences.
Name
— Name property of simulink.sampletimecolors.Palette
object
string | character vector
Name property the simulink.sampletimecolors.Palette
object that
you want to return, specified as a string or a character vector.
Example: simulink.sampletimecolors.getPalette('Name'='myFirstPalette')
Version History
Introduced in R2024b
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)