Files
matlab-python/RSN/datainiziale.m

21 lines
699 B
Matlab
Executable File

% Funzione che scarica la data iniziale per quell'installazione
function [date,time,unitID] = datainiziale(DTcatena,unitID,conn,FileName)
text = 'datainiziale function started';
fileID = fopen(FileName,'a');
fmt = '%s \r';
fprintf(fileID,fmt,text);
unitID = num2str(cell2mat(unitID));
comando = ['select prod_date from tools where unit_ID like ''' unitID ''' and name like ''' DTcatena ''' '];
data_ini = fetch(conn,comando);
stringa = cell2mat(data_ini);
[lS] = length(stringa);
date = stringa(1,1:10);
time = stringa(1,12:lS);
text = ['Starting date for the download of data: ' date ' ' time '. datainiziale function closed.'];
fprintf(fileID,fmt,text);
fclose(fileID);
end