function threshold(yesHD,ARRAYdateHD,Xlocal_HD,Ylocal_HD,X_HD,Y_HD,HShift_local_HD,... HShift_HD,NodoTiltLinkHD,unitID,IDcentralina,DTcatena,conn,FileName) fileID = fopen(FileName,'a'); fmt = '%s \r'; text = 'threshold function started'; fprintf(fileID,fmt,text); fclose(fileID); % Scarico la data di riferimento comando = ['select graph_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); dataRif = stringa(1,1:10); timeRif = stringa(1,12:lS); if lS == 4 % Codice null - non c'è data di riferimento Riferimento = 0; else Riferimento = 1; end comando = ['select soglie from tools where unit_id like ''' ... unitID ''' and name like ''' DTcatena ''' ']; Soglie = fetch(conn,comando); value = jsondecode(char(Soglie)); if isempty(value) == 0 %% Tilt Link HD if yesHD == 1 threshold_TiltLinkHD(value,ARRAYdateHD,HShift_local_HD,HShift_HD,... Xlocal_HD,Ylocal_HD,X_HD,Y_HD,Riferimento,dataRif,timeRif,... NodoTiltLinkHD,IDcentralina,DTcatena,conn,FileName); end end fileID = fopen(FileName,'a'); fmt = '%s \r'; text = 'threshold function closed'; fprintf(fileID,fmt,text); fclose(fileID);