如题所述
x=numE(1:end)./1e4;% cost
for i=3:1:(length(numE)+2)
label1{i-2,1} = txtE{i,1};% label
end
ax1 = subplot(1,2,1);
explode1=[zeros(1,length(x)-1),1];
p=pie(ax1,x,explode1);
title(ax1,'Main-Cost Distribution');
%%以下为比例+标注
pText = findobj(p,'Type','text');
percentValues = get(pText,'String');
combinedtxt = strcat(label1,percentValues);
for i=1:1:length(x)
pText(i).String = combinedtxt(i);
end
温馨提示:答案为网友推荐,仅供参考