function [indiceX,indiceZ] = segnoTuL(IDcentralina,DTcatena,FileName) fileID = fopen(FileName,'a'); fmt = '%s \r'; text = 'segnoTuL function started'; fprintf(fileID,fmt,text); NomeFile = strcat(IDcentralina,'-',DTcatena,'-','Azzeramenti.txt'); if isfile(NomeFile) == 1 Dati = importdata(NomeFile); else Dati = []; % Aggiunto 23/09/21 fclose(fileID); Parametro1 = 99999; Parametro2 = 9999999999; 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 = 'segnoTuL function created the reference file correctly'; fprintf(fileID,fmt,text); end %% Calcolo orario [r,~] = size(Dati); indiceX = []; n = 1; for a = 1:r if Dati(a) == 99999 for ab = a+1:r if Dati(ab) < 99999 for aa = ab:r if Dati(aa) == 9999999999 break else indiceX(n) = Dati(aa); n = n+1; end end end break end end end %% Calcolo antiorario nn = 1; indiceZ = []; for a = 1:r if Dati(a) == 9999999999 for aa = a+1:r if Dati(aa) < 99999 indiceZ(nn) = Dati(aa); nn = nn+1; end end end end text = 'segnoTuL function worked correctly'; fprintf(fileID,fmt,text); fclose(fileID); end