Skip to content

Commit dd0cdf4

Browse files
author
埃博拉酱
committed
Graphics.PLine:修复非数值型errorbar的错误
1 parent 05adc9e commit dd0cdf4

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

+MATLAB/+Graphics/PLine.m

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,18 @@
113113
YData=YData(Index);
114114
end
115115
if isa(ObjectA,'matlab.graphics.chart.primitive.ErrorBar')
116-
if ~isempty(ObjectA.YNegativeDelta)
117-
YPNData(1,:)=-ObjectA.YNegativeDelta(Index);
116+
117+
%无论有没有空,YPNData必须是(2,2)矩阵,且数据类型未必是数值,所以需要如下精心设计:
118+
if isempty(ObjectA.YNegativeDelta)
119+
YPNData(2,:)=ObjectA.YPositiveDelta(Index);
120+
else
121+
YPNData(2,:)=-ObjectA.YNegativeDelta(Index);
122+
YPNData=flipud(YPNData);
118123
end
119-
if ~isempty(ObjectA.YPositiveDelta)
124+
if~isempty(ObjectA.YPositiveDelta)
120125
YPNData(2,:)=ObjectA.YPositiveDelta(Index);
121126
end
127+
122128
YData=YData+YPNData([2,4]-(YData<0));
123129
end
124130
else

0 commit comments

Comments
 (0)