问题描述
leg2 = strcat('Max Degree:',num2str(adet(1,1)/ CH(1)));
leg3 = strcat('Min Degree:',num2str(adet(1,2)/ ch(l)));
leg4 = strcat('Max Request:',num2str(adet(1,3)/ ch(l)));
leg5 = strcat('Min Request:',num2str(adet(1,4)/ ch(l)));
leg6 = strcat('Max Priority:',num2str(adet(1,5)/ ch(l)));
leg7 = strcat('Random:',num2str(adet(1,6)/ ch(l)));
leg8 = strcat('AICS:',num2str(adet(1,7)/ ch(l)));
legend(leg2,leg3,leg4,leg5,leg6,leg7,leg8,'Location','SouthWest');
这里, 我可以用 I have this: Here, I can do it with Use a format specifier in 这篇关于在matlab中设置图例的精度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! adet(1,1)/ ch(l) code>是一个介于0和1之间的数字。有时它变成类似于
0.01666667
的东西。我想为它设置一个精度,使其像0.02。
disp() code>函数与
格式bank
。但是我不知道如何将它应用到情节中。对于英文不好的人来说很抱歉。 num2str
(位于图例
statement):
>> num2str(pi)%//默认
ans =
3.1416
>> num2str(pi,'%.2f')%//两位小数
ans =
3.14
leg2=strcat('Max Degree :',num2str(adet(1,1)/ch(l)));
leg3=strcat('Min Degree :',num2str(adet(1,2)/ch(l)));
leg4=strcat('Max Request :',num2str(adet(1,3)/ch(l)));
leg5=strcat('Min Request :',num2str(adet(1,4)/ch(l)));
leg6=strcat('Max Priority :',num2str(adet(1,5)/ch(l)));
leg7=strcat('Random :',num2str(adet(1,6)/ch(l)));
leg8=strcat('AICS :',num2str(adet(1,7)/ch(l)));
legend(leg2,leg3,leg4,leg5,leg6,leg7,leg8,'Location','SouthWest');
adet(1,1)/ch(l)
is a number between 0 and 1. And sometimes it becomes something like 0.01666667
. I'd like to set a precision for it to make it something like "0.02".disp()
function with the format bank
. But I don't know how to apply it in a plot. and sorry for bad english.num2str
(within the legend
statement):>> num2str(pi) %// default
ans =
3.1416
>> num2str(pi, '%.2f') %// two decimal figures
ans =
3.14