Help Center
Get line color in comparison plot
Since R2021b
color = Simulink.sdi.getComparisonColor(opt)
color = Simulink.sdi.getComparisonColor(opt) returns the color of the comparison plot element specified by opt.
color
opt
example
collapse all
Open the vdp model.
vdp
mdl = "vdp"; open_system(mdl)
In the model, set the value of the Mu block to 1.2. Alternatively, you can use the set_param function to set the value of the block programmatically.
Mu
1.2
set_param
set_param("vdp/Mu","gain","1.2")
Simulate the vdp model to create a run.
sim(mdl);
Set the value of the Mu block to 0.5. Then, simulate the model again to create another run.
0.5
set_param("vdp/Mu","gain","0.5") sim(mdl);
Compare the two runs. For more information about how to interactively compare data, see Compare Simulation Data.
runIDs = Simulink.sdi.getAllRunIDs; runID1 = runIDs(end-1); runID2 = runIDs(end); diffResult = Simulink.sdi.compareRuns(runID1,runID2);
Set the baseline run color to purple using a 1-by-3 RGB vector.
Simulink.sdi.setComparisonColor("baselineColor",[0.7 0.27 1])
Use the Simulink.sdi.getComparisonColor function to get the 1-by-3 RGB vector for the line color of the comparison run.
Simulink.sdi.getComparisonColor
compColor = Simulink.sdi.getComparisonColor("compareToColor")
compColor = 1×3 0.8510 0.3255 0.0980
"baselineColor"
"compareToColor"
"toleranceColor"
"differenceColor"
Comparison plot element for which to set the color, specified as:
"baselineColor" — Baseline signal
"compareToColor" — Comparison signal
"toleranceColor" — Tolerance band
"differenceColor" — Difference between baseline and comparison signals
Example: "baselineColor"
Line color, returned as a 1-by-3 RGB vector with values between 0 and 1.
0
1
Introduced in R2021b
Simulink.sdi.setComparisonColor
Simulink.sdi.compareSignals
Simulink.sdi.compareRuns
Simulink.sdi.DiffRunResult
Simulink.sdi.DiffSignalResult
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
Europe
Asia Pacific
Contact your local office