function dbset ( start_dt,end_dt, pos, varr);
% send data to "pos" column of the database 

% read config file db_cong.pc

f = fopen('db_config.pc','r');
    serv = fgetl(f);
    log = fgetl(f);
    pass = fgetl(f);
    dbname  = fgetl(f);
    table = fgetl(f);
    
fclose(f);

% make db formated time intervals
start_time =  datenum(start_dt);
end_time =  datenum(end_dt);
    s_time = ['"' datestr(start_time,'yyyy-mm-dd HH:MM:SS') '"'];             
    e_time = ['"' datestr(end_time,'yyyy-mm-dd HH:MM:SS') '"'];   
    (end_time-start_time)*1440;
%set data to db
mysql('open', serv,log,pass);
  mysql(['use ' dbname]);
    
     k=1; 
     
     for i= start_time:1/1440:end_time
        vr = varr(k);
        k=k+1;   
            str = 'NULL';
            if ~isnan(vr);  str=['"' num2str(round(vr)) '"']; end;
        time = ['"' datestr(i,'yyyy-mm-dd HH:MM:SS') '"'];   
        disp (time);
        sqlstr=['update ' table ' set ' pos ' = ' str ' where time = ' time ';'];
        mysql(sqlstr);
 
     end    
     
  mysql('close');
