我已經寫了一個簡單的八度繪圖功能,下面的代碼,但不幸的是需要一些時間來繪圖。有什麼方法可以加快速度?加快環形八度繪圖功能
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