function date2db (yr);

% read config file db_config.pc

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

% open DB
 
 mysql('open', serv,log,pass);
 mysql(['use ' dbname]);
 
 
    start_time =  datenum(yr,1,1,0,0,0)
      year_days = sum(eomday(yr, 1:12));



    for i= start_time:1/1440:start_time+year_days-1/1440
       
        tm = datestr(i);
        time = ['"' datestr(tm,'yyyy-mm-dd HH:MM:SS') '"'];
        disp(time)
        mysql(['INSERT INTO ' table ' (time,x,y,z) VALUES (' time ', NULL , NULL , NULL) ON DUPLICATE KEY UPDATE  x=NULL, y=NULL, z=NULL ;']);
        
    
    end    
    
 mysql('close');
 
