Main Content

setColor

Set text color in Model Advisor analysis results

Description

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

Note

The setColor function formats 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 with a message.

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

Set the text color to yellow by using the setColor method with the value 'warn' (which corresponds to yellow in Model Advisor).

setColor(result,"warn");

You can also use this approach in a check callback function. Use setColor in a check callback function in your sl_customization file to format your Model Advisor results.

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

Input Arguments

collapse all

Text for the Model Advisor output, returned as a ModelAdvisor.Text object.

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

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

Version History

Introduced in R2007b