-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathget_pc_settings.m
62 lines (50 loc) · 1.42 KB
/
get_pc_settings.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
function [os_ver, os_bit, matlab_ver, matlab_bit, matlab_tlbx] = get_pc_settings()
%% OS VERSION & BIT
osv = system_dependent('getos');
if ~isempty(strfind(osv, 'Linux'))
os_ver = 'Linux';
if ~isempty(strfind(osv, 'x86_64'))
os_bit = '64';
else
os_bit = '32';
end
elseif ~isempty(strfind(osv, 'Win'))
os_ver = 'Windows';
if ~isempty(strfind(osv, 'XP'))
os_bit ='32';
else
[status,str] = system('wmic OS get OSArchitecture');
idx = find(double(str)==10, 1,'first');
if strcmp(str(idx + 1:idx + 2),'64')
os_bit = '64';
else
os_bit = '32';
end
end
else
os_ver = 'Mac';
os_bit = '64';
end
%% MATLAB VERSION
matlab_ver = computer('arch');
%% MATLAB BIT
if ~isempty(findstr('64',matlab_ver))
matlab_bit = '64';
else
matlab_bit = '32';
end
%% MATLAB TOOLBOXES
tlbx_cnt = 0;
v = ver;
for vid=1:length(v)
if strcmp(v(vid).Name, 'MATLAB')
matlab_ver = v(vid).Version;
else
tlbx_cnt = tlbx_cnt + 1;
matlab_tlbx(tlbx_cnt) = v(vid);
end
end
if ~isstruct(matlab_tlbx)
matlab_tlbx = [];
end
end