使用 Surf、X Y Z 和 C 的问题不能很复杂
Issue using Surf, X Y Z and C cannot be complex
我正在尝试为我的表面图添加标题,但尝试向该图添加任何描述性文本会导致上述错误。我可以很好地绘制数据,但尝试添加标题会引发错误。我在下面列出了我的代码,但无法弄清楚为什么简单的文本标题会导致问题。我会很感激任何想法。谢谢!
function LWMMSweepPlots(excel,cpb,rpb)
data=xlsread(excel);
[r,c]=size(data);
iterations=round(c./cpb);
for i=1:iterations;
power=data(1:rpb,cpb*(i-1)+1:cpb*(i-1)+cpb);
xone=data(rpb*4-3:rpb*4-3+(rpb-1),cpb*(i-1)+1:cpb*(i-1)+cpb);
yone=data(rpb*5-2:rpb*5-2+(rpb-1),cpb*(i-1)+1:cpb*(i-1)+cpb);
xtwo=data(rpb+2,cpb*(i-1)+1);
ytwo=data(rpb*2+3,cpb*(i-1)+1);
xtn=num2str(xtwo);ytn=num2str(ytwo);
mytitle=strcat('X2,Y2 Coordinates:',xtn,',',ytn);
figure;surf(xone,yone,power,title(mytitle))
end
end
这不是您添加标题的方式。如果要添加标题,则需要单独使用 title
。按照他们的方式,MATLAB 将 title
的 输出视为曲面的 CData
。
figure
surf(xone, yone, power)
title(mytitle)
我正在尝试为我的表面图添加标题,但尝试向该图添加任何描述性文本会导致上述错误。我可以很好地绘制数据,但尝试添加标题会引发错误。我在下面列出了我的代码,但无法弄清楚为什么简单的文本标题会导致问题。我会很感激任何想法。谢谢!
function LWMMSweepPlots(excel,cpb,rpb)
data=xlsread(excel);
[r,c]=size(data);
iterations=round(c./cpb);
for i=1:iterations;
power=data(1:rpb,cpb*(i-1)+1:cpb*(i-1)+cpb);
xone=data(rpb*4-3:rpb*4-3+(rpb-1),cpb*(i-1)+1:cpb*(i-1)+cpb);
yone=data(rpb*5-2:rpb*5-2+(rpb-1),cpb*(i-1)+1:cpb*(i-1)+cpb);
xtwo=data(rpb+2,cpb*(i-1)+1);
ytwo=data(rpb*2+3,cpb*(i-1)+1);
xtn=num2str(xtwo);ytn=num2str(ytwo);
mytitle=strcat('X2,Y2 Coordinates:',xtn,',',ytn);
figure;surf(xone,yone,power,title(mytitle))
end
end
这不是您添加标题的方式。如果要添加标题,则需要单独使用 title
。按照他们的方式,MATLAB 将 title
的 输出视为曲面的 CData
。
figure
surf(xone, yone, power)
title(mytitle)