Main Content

simulink.sampletimecolors.removePalette

Remove simulink.sampletimecolors.Palette object from preferences

Since R2024b

    Description

    simulink.sampletimecolors.removePalette('paletteName') removes or deletes the simulink.sampletimecolors.Palette object specified by paletteName from MATLAB® preferences.

    The function simulink.sampletimecolors.removePalette removes the specified palette from MATLAB preferences even if that palette is currently active or is set as a default palette. When the palette is removed, the software restores the built-in.

    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"];
    simulink.sampletimecolors.storePalette(pltObj)

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

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

    Now, assume that you want to remove the custom palette, myFirstPalette from the preferences. Use the simulink.sampletimecolors.removePalette function. Once the custom palette is removed, the color palette for sample time colors is restored to the factory default color palette.

    simulink.sampletimecolors.removePalette('myFirstPalette')

    Input Arguments

    collapse all

    Name of the simulink.sampletimecolors.palette object, specified as a string or a character vector.

    Version History

    Introduced in R2024b