ГОСТ Р ИСО/МЭК 10373-6—2015
,■»** сесlare function prototype ***/
int File_lniO(Char * , double *)/
in», readcsv{char * ,douDle * ,dauble * );
int wntecsvlchar*
,
ifit. ,double * ,double * ,double * j;
in». SIiding_LMA{double ,in». ,double *,double *,int ,double *,double *,double *);
void NolseSTE{int ,double *,double
* ,
double *,double *);
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
/*.. File_lnfo function
* * * /
#♦♦/
/*** Descript.ion:
***/
/*** This f
unc».ion parse
a
file in
CSV
forma».
* * * /
/*** t.odetermine the number of linesand sampling rate
***/
/ * . .*«*/
/►** input: filename
***/
/ * . ,*«*/
/***
Re*.um: Number of samples (Sample
Court».)
* * * /
/***0 if
an eitor occurred
***/
/***
•**/
int Flle_lnfO(Chat * fname , double * pdt)
Г
int
X ,
c ;
double
1
1
,vl,t
2
,v
2
;
FILE*sampie_Ule;
/*•*<*•*«*•*« open File
• * • * * * • * * * • * * * • * * * * * + * • /
r f ( ’strch r(fn am e,stre e t (fname, ” .csv">?
i f ((sample file - fopen(£neme, " r " ) ) ~ KELL)
<
pr int.f {“ Cannot, open input file Vs.Vn"’, lname) ;
return 0;
J
/ • * *
Reaa two first lin e s to r e tr ie v e sampling ra te ***/
t s c a n f(s a m p le Jlle ," IL f, 4L£\n", 4 t l, 4vl>;
it (feo f (sample file),*
Ic lo se {sam ple_iile);
1
re».urn 0;
fsean f (sam p le_ flle,"’:L £,’L f\n “ , 4t2, 4 v2j;
i f (£eoC(sample_iile> >
i
fclose{sam ple_iile) ;
return 0;
I
* p d t - t 2 - t 1;
i -
2
;
w hile (! feo f (sample_file>)
i
c - fget.cfsam p lejile) ;
i f {e — *\n’)
l
i*«;
i t (
a
>-MAX_SAMPLES>
1
p r i n t f { “Too many samples in input file: only
d
samples retainedN n",
i>;
break;
194