@@ -6,43 +6,7 @@ function GLG_Instance(Data,varargin)
66%
77tic
88% %% InputParser
9- p = inputParser ;
10- def_lambda = 0.01 ;
11- def_dT = 1 ;
12- def_rep = 0 ;
13- def_width = 2 ;
14- def_probzero = 0 ;
15- def_family = ' gaussian' ;
16- def_L = 15 ;
17- def_ID = 0 ;
18- def_outdir = ' Output' ;
19- def_prob_remove_samples = 0.2 ;
20- def_date = date ;
21- %
22- expected_family = {' gaussian' ,' poisson' };
23- validScalar = @(x ) isnumeric(x ) && isscalar(x ) && (x >= 0 );
24- validFile = @(x ) isfilecomp(x );
25- validString = @(x ) ischar(x ) && isempty(regexp(x ,' [\/?*'' ."<>|]' ,' once' ));
26- validInteger = @(x ) (x - floor(x )==0 ) && (x >= 0 );
27- validLags = @(x ) (x - floor(x )==0 ) && (p .Results .dT * x )<100;
28- validProb = @(x ) isnumeric(x ) && isscalar(x ) && (x >= 0 ) &&(x < 1);
29- validDate = @(x ) any(ismember({datestr(datenum(x ) ,[' mm/dd/yyyy' ]) datestr(datenum(x ))},x ));
30- addRequired(p ,' Data' ,validFile );
31- addParameter(p ,' family' ,def_family ,@(x ) any(validatestring(x ,expected_family )));
32- addParameter(p ,' outdir' ,def_outdir ,validString );
33- addParameter(p ,' lambda' ,def_lambda ,validScalar );
34- addParameter(p ,' dT' ,def_dT ,validScalar );
35- addParameter(p ,' num_lags' ,def_L ,validLags );
36- addParameter(p ,' kernel_width' ,def_width ,validScalar );
37- addParameter(p ,' prob_zero_removal' ,def_probzero ,validProb );
38- addParameter(p ,' prob_remove_samples' ,def_prob_remove_samples ,validProb );
39- addParameter(p ,' replicate' ,def_rep ,validInteger );
40- addParameter(p ,' ID' ,def_ID ,validInteger );
41- addParameter(p ,' date' ,def_date ,validDate );
42- parse(p ,Data ,varargin{: });
43- params = p .Results ;
44- params.p1 = p .Results .dT * p .Results .num_lags ;
45- params.DateNumber = datenum(params .date );
9+ params = parseParams(Data ,varargin{: })
4610mkdir(params .outdir )
4711% %% End InputParser
4812tic ;
@@ -89,20 +53,4 @@ function GLG_Instance(Data,varargin)
8953if isdeployed
9054 quit ;
9155end
92- end
93-
94- function y = isfilecomp(x )
95- if verLessThan(' matlab' ,' 9.3' )
96- if (exist([x ' .mat' ], ' file' ) == 2 )||(exist(x , ' file' ) == 2 )
97- y = 1 ;
98- else
99- y = 0 ;
100- end
101- else
102- if (isfile([x ' .mat' ])||isfile(x ))
103- y = 1 ;
104- else
105- y = 0 ;
106- end
107- end
10856end
0 commit comments