Main Content

setColor

Specify text color in Model Advisor analysis results

    Description

    setColor(textObj,colorValue) sets the textObj color to the color specified by colorValue.

    Note

    The function setColor is for formatting Model Advisor analysis results with Simulink® Check™. For more information, see Simulink Check.

    For information on how to format text in MATLAB®, see Formatting Text.

    example

    Examples

    collapse all

    Create a Model Advisor text object and make the text yellow.

    Use ModelAdvisor.Text to create Model Advisor text object t1.

    result = ModelAdvisor.Text('This is a warning in yellow.');
    

    Set the text color to yellow. The text color yellow is associated with the value 'warn'.

    setColor(result, 'warn');
    

    Use setColor in a check callback function in your sl_customization file to format your results.

    function result = SampleStyleOneCallback(system)
    result = ModelAdvisor.Text('This is a warning in yellow.');
    setColor(result, 'warn');
    end

    For more information on using check callback functions to format text, see Specify Text in the Model Advisor Output. For more information on how to format check results, see Display and Enable Check.

    Input Arguments

    collapse all

    Model Advisor result text, specified as a ModelAdvisor.Text object.

    Text color setting, specified by one of the values listed in this table.

    ValueText Color
    'normal'Black
    'pass'Green
    'warn'Yellow
    'fail'Red
    'keyword'Blue