%% Funzione che mette a zero gli spostamenti di alcuni nodi specifici function angRSNHR = azzeramenti_RSNHR(conn,IDcentralina,DTcatena,angRSNHR,... NodoRSNLinkHR,ARRAYdateRSNHR,FileName) fileID = fopen(FileName,'a'); fmt = '%s \r'; text = 'azzeramenti_RSNHR function started'; fprintf(fileID,fmt,text); NomeFile = strcat(IDcentralina,'-',DTcatena,'-','Azzeramenti.txt'); if isfile(NomeFile) == 1 Dati = importdata(NomeFile); i = 1; while Dati(i,1) ~= 99999 i = i+1; % cerco il dato corrispondente al MEMS, il successivo è % quello dell'ampolla corrispondente end i = i+1; if Dati(i,1) == 999999999 else [c,~] = size(Dati); while i <= c if Dati(i,1) == 999999999 break else NodeType ='RSN Link HR'; indice = Dati(i); NodeNumRSNHR = num2str(cell2mat(NodoRSNLinkHR(indice,2))); dataRIF = num2str(ARRAYdateRSNHR(end)-7); comando = ['select AlfaX, AlfaY from ElabDataView where EventDate >= ''' ... dataRIF ''' and UnitName = ''' IDcentralina ... ''' and ToolNameID = ''' DTcatena ''' and NodeType = ''' NodeType ... ''' and NodeNum =' NodeNumRSNHR ' ']; curs = exec(conn,comando); curs = fetch(curs); Riferimento = curs.Data; angRSNHR(:,2*indice-1:2*indice) = Riferimento(end,1:2); text = ['Node RSN Link HR number ' NodeNumRSNHR ' has been corrected by azzeramenti function']; fprintf(fileID,fmt,text); i=i+1; end end end else fclose(fileID); Parametro1 = 99999; Parametro2 = 999999999; outdat = fopen(NomeFile,'wt+'); fopen(NomeFile,'wt'); fmt = '%d \r'; fileA = fopen(NomeFile,'a'); fprintf(fileA,fmt,Parametro1); fprintf(fileA,fmt,Parametro2); fclose(fileA); fileID = fopen(FileName,'a'); fmt = '%s \r'; text = 'azzeramenti function created the reference file correctly'; fprintf(fileID,fmt,text); end text = 'azzeramenti_RSNHR function executed correctly'; fprintf(fileID,fmt,text); fclose(fileID); end