我已经写了一个简单的八度绘图功能,下面的代码,但不幸的是需要一些时间来绘图。有什么方法可以加快速度?加快环形八度绘图功能
function hilo_conditional_plot(high , low , condition)
%HILO_CONDITIONAL_PLOT
% Takes high, low and condition input vectors and plots a line chart of highs
% and lows coloured according to the condtion. For this basic version there
% are only 3 conditons; 1 for long, -1 for short and 0 for neutral; with the
% respective plot colours being blue, red and green.
date = (1 : length(high))' ;
hold on ;
for ii = 1 : length(high)
if condition(ii) == 1
line([ date(ii) date(ii) ] , [ low(ii) high(ii) ] , 'Color' , 'b' , 'linewidth' , 2) ;
elseif condition(ii) == -1
line([ date(ii) date(ii) ] , [ low(ii) high(ii) ] , 'Color' , 'r' , 'linewidth' , 2) ;
elseif condition == 0
line([ date(ii) date(ii) ] , [ low(ii) high(ii) ] , 'Color' , 'g' , 'linewidth' , 2) ;
else
printf('Error in condition vector - a value != 1,-1 or 0') ;
end
end
grid minor on ;
hold off ;
编辑:高和低列将包含数值财务数据和条件列将包含一个1,-1或0的值,E,G。
1.2 1.1 0
1.3 1.1 1
1.4 0.9 -1
跨张贴在http://octave.1599824.n4.nabble.com/Speeding-up-a-plotting-function -td4680459.html – babelproofreader
您能否提供一个'high','low'和'condition'的小样本?这不是强制性的,但它是更好地理解问题:) – RCaetano