-
Notifications
You must be signed in to change notification settings - Fork 3
/
run.m
67 lines (48 loc) · 1.75 KB
/
run.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
warning('off','all');
close('all');
clearvars();
clc();
delete(allchild(0));
[path,~,~] = fileparts(mfilename('fullpath'));
if (~strcmpi(path(end),filesep()))
path_base = [path filesep()];
end
if (~isempty(regexpi(path_base,'Editor')))
path_base_fs = dir(path_base);
is_live = ~all(cellfun(@isempty,regexpi({path_base_fs.name},'LiveEditorEvaluationHelper')));
if (is_live)
pwd_curr = pwd();
if (~strcmpi(pwd_curr(end),filesep()))
pwd_curr = [pwd_curr filesep()];
end
while (true)
ia = inputdlg('It looks like the program is being executed in a non-standard mode. Please, confirm or change the root folder of this package:','Manual Input Required',1,{pwd_curr});
if (isempty(ia))
return;
end
path_base_new = ia{:};
if (isempty(path_base_new) || strcmp(path_base_new,path_base) || strcmp(path_base_new(1:end-1),path_base) || ~exist(path_base_new,'dir'))
continue;
end
path_base = path_base_new;
break;
end
end
end
if (~strcmpi(path_base(end),filesep()))
path_base = [path_base filesep()];
end
paths_base = genpath(path_base);
paths_base = strsplit(paths_base,';');
for i = numel(paths_base):-1:1
path_cur = paths_base{i};
if (~strcmp(path_cur,path_base) && isempty(regexpi(path_cur,[filesep() 'Scripts'])))
paths_base(i) = [];
end
end
paths_base = [strjoin(paths_base,';') ';'];
addpath(paths_base);
file = fullfile(path_base,['Datasets' filesep() 'Example_Small.xlsx']);
data = importdata(file);
benford_analyse(data);
rmpath(paths_base);