function out = dbget ( start_dt,end_dt, pos)
% get data from "pos" collumn 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') '"'];   

%get data from db
mysql('open', serv,log,pass);
  mysql(['use ' dbname]);
    out = mysql(['select ' pos ' from ' table ' where time >= ' s_time ' and time <= ' e_time ';']);
  mysql('close');
