function [date_t,time_t,open_t,close_t,high_t,low_t]=transf_ochl(date1,time1,date2,time2,open2,close2,high2,low2,minutes)

% extrait les données en 1 min à partir de fichier à échantillonnage plus
% élevé.

date_t=-1*ones(size(time2,1),1);
time_t=-1*ones(size(time2,1),1);
open_t=-1*ones(size(time2,1),1);
close_t=-1*ones(size(time2,1),1);
high_t=-1*ones(size(time2,1),1);
low_t=-1*ones(size(time2,1),1);

j=1;
i=1;
if minutes<60 
    nb_c=60/minutes;
    time_test=zeros(nb_c*24+1,1);
    while time_test((j-1)*nb_c+i)<(2359-minutes)
        for i=1:nb_c
            time_test((j-1)*nb_c+i)=(j-1)*100+(i-1)*minutes;
        end;
        j=j+1;
        i=0;
    end;
end;
time_test(end)=2400;
[lig,~]=find(time_test==1700);
if lig~=0
    time_test(lig)=1659;
end;
[lig,~]=find(time1==0);
time1(lig)=2400;
date1(lig)=date1(lig-1);
for i=1:size(time1,1)
    [lig,~]=find(date2==date1(i));
    [lig_t,~]=find(time_test==time1(i));
    [lig2,~]=find(time2(lig)<=time_test(lig_t) & time2(lig)>time_test(lig_t-1));
    date_t(lig(lig2))=date2(lig(lig2));
    time_t(lig(lig2))=time2(lig(lig2));
    open_t(lig(lig2))=open2(lig(lig2));
    close_t(lig(lig2))=close2(lig(lig2));
    high_t(lig(lig2))=high2(lig(lig2));
    low_t(lig(lig2))=low2(lig(lig2));
end;

[lig,~]=find(date_t~=-1);
date_t=date_t(lig);
time_t=time_t(lig);
open_t=open_t(lig);
close_t=close_t(lig);
high_t=high_t(lig);
low_t=low_t(lig);




