MATLAB 帮助中心
Set line color in comparison plot
Since R2021b
Simulink.sdi.setComparisonColor(opt,color)
Simulink.sdi.setComparisonColor(opt,color) sets the color of the comparison plot element opt using the RGB vector specified by color.
opt
color
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, specified as a 1-by-3 RGB vector of doubles with values between 0 and 1.
0
1
Example: [0.7 0.27 1]
[0.7 0.27 1]
Data Types: double
double
Introduced in R2021b
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.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
欧洲
亚太
联系您当地的办事处