Main Content

simulink.sampletimecolors.applyPalette

Apply sample time color palette to current MATLAB session

Since R2024b

    Description

    simulink.sampletimecolors.applyPalette(paletteObject) applies the simulink.sampletimecolors.Palette object specified by paletteObject to the current MATLAB® session.

    simulink.sampletimecolors.applyPalette('paletteName') applies the simulink.sampletimecolors.Palette object that has its Name property set to paletteName to the current MATLAB session.

    simulink.sampletimecolors.applyPalette(___,'UserDefault'='true') sets the simulink.sampletimecolors.palette object as the default palette for current and future MATLAB session.

    example

    Examples

    collapse all

    Create a custom palette for sample time colors and store that palette in MATLAB preferences.

    Create a custom color palette.

    pltObj = simulink.sampletimecolors.Palette('myFirstPalette');
    pltObj.ContinuousSampleTimeColors = [0.9 0.2 0.4];
    pltObj.DiscreteSampleTimeColors = ["#123456", "#523467", "#204973"];

    Store the palette for current or future use in MATLAB preferences. To store the palette, use the simulink.sampletimecolors.storePalette function.

    simulink.sampletimecolors.storePalette(pltObj)

    Apply the palette for current and future use in MATLAB preferences. When you use the simulink.sampletimecolors.applyPalette function with the paletteObject argument and the option 'UserDefault' set to 'on', the specified paletteObject is applied to the current MATLAB sessions and set as a default for all future MATLAB sessions.

    simulink.sampletimecolors.applyPalette(pltObj,'UserDefault',on');

    Input Arguments

    collapse all

    Color palette object used to set customized sample time colors, specified as a simulink.sampletimecolors.Palette object.

    pltObj = simulink.sampletimecolors.Palette;
    simulink.sampletimecolors.storePalette(pltObj)

    Name property of an existing simulink.sampletimecolors.Palette object, specified as a string or a character vector.

    Option to set default color palette for current and future MATLAB sessions, specified as 'true'.

    Example: simulink.sampletimecolors.applyPalette(myPalette,'UserDefault'='true')

    Version History

    Introduced in R2024b