-
Notifications
You must be signed in to change notification settings - Fork 13
/
GannetVersion.m
80 lines (70 loc) · 2.36 KB
/
GannetVersion.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
68
69
70
71
72
73
74
75
76
77
function GannetVersion
% Return the version numbers of Gannet and its modules
% GannetLoad
loadFile = which('GannetLoad');
if isempty(loadFile)
error('Cannot find GannetLoad.m; please ensure that your Gannet directory is included in your MATLAB search path.')
end
fileID = fopen(loadFile, 'rt');
if fileID == -1
error('Cannot read %s.', loadFile);
end
str = fread(fileID, Inf, '*uchar');
fclose(fileID);
str = char(str(:)');
expression = '(?<field>MRS_struct.version.Gannet = )''(?<version>.*?)''';
out = regexp(str, expression, 'names');
fprintf('\n--------------------------------------');
fprintf('\nYour version of Gannet is %s', out.version);
fprintf('\n--------------------------------------');
expression = '(?<field>MRS_struct.version.load = )''(?<version>.*?)''';
out = regexp(str, expression, 'names');
fprintf('\nGannetLoad: %s', out.version);
% GannetFit
loadFile = which('GannetFit');
fileID = fopen(loadFile, 'rt');
if fileID == -1
error('Cannot read %s.', loadFile);
end
str = fread(fileID, Inf, '*uchar');
fclose(fileID);
str = char(str(:)');
expression = '(?<field>MRS_struct.version.fit = )''(?<version>.*?)''';
out = regexp(str, expression, 'names');
fprintf('\nGannetFit: %s', out.version);
% GannetCoRegister
loadFile = which('GannetCoRegister');
fileID = fopen(loadFile, 'rt');
if fileID == -1
error('Cannot read %s.', loadFile);
end
str = fread(fileID, Inf, '*uchar');
fclose(fileID);
str = char(str(:)');
expression = '(?<field>MRS_struct.version.coreg = )''(?<version>.*?)''';
out = regexp(str, expression, 'names');
fprintf('\nGannetCoRegister: %s', out.version);
% GannetSegment
loadFile = which('GannetSegment');
fileID = fopen(loadFile, 'rt');
if fileID == -1
error('Cannot read %s.', loadFile);
end
str = fread(fileID, Inf, '*uchar');
fclose(fileID);
str = char(str(:)');
expression = '(?<field>MRS_struct.version.segment = )''(?<version>.*?)''';
out = regexp(str, expression, 'names');
fprintf('\nGannetSegment: %s', out.version);
% GannetQuantify
loadFile = which('GannetQuantify');
fileID = fopen(loadFile, 'rt');
if fileID == -1
error('Cannot read %s.', loadFile);
end
str = fread(fileID, Inf, '*uchar');
fclose(fileID);
str = char(str(:)');
expression = '(?<field>MRS_struct.version.quantify = )''(?<version>.*?)''';
out = regexp(str, expression, 'names');
fprintf('\nGannetQuantify: %s\n\n', out.version);