Skip to content

Commit e0af872

Browse files
committed
platform_tell works back to R2016b+
1 parent 5215e25 commit e0af872

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

+stdlib/platform_tell.m

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
%% PLATFORM_TELL - Display information about the platform and environment
2+
% designed to work back to R2016b
23

34
function json = platform_tell()
45

@@ -8,10 +9,10 @@
89
r = "R" + version('-release');
910
end
1011

11-
raw = struct("matlab_release", r, ...
12-
"matlab_arch", computer('arch'), ...
13-
"hdf5", stdlib.h5get_version(), ...
14-
"netcdf", stdlib.nc_get_version());
12+
raw = struct('matlab_release', r, ...
13+
'matlab_arch', computer('arch'), ...
14+
'hdf5', stdlib.h5get_version(), ...
15+
'netcdf', stdlib.nc_get_version());
1516

1617
if stdlib.has_java()
1718
raw.java_vendor = stdlib.java_vendor();
@@ -35,21 +36,26 @@
3536

3637
for lang = ["C", "Cpp", "Fortran"]
3738
co = mex.getCompilerConfigurations(lang);
39+
ct = ['compiler_' lang{1}];
40+
vt = ['compiler_' lang{1} '_version'];
41+
raw.(ct) = "";
42+
raw.(vt) = "";
3843

3944
if ~isempty(co)
40-
raw.("compiler_" + lang) = co.ShortName;
41-
raw.("compiler_" + lang + "_version") = co.Version;
45+
raw.(ct) = co.ShortName;
46+
raw.(vt) = co.Version;
4247
end
4348
end
4449

4550
try
4651
json = jsonencode(raw, "PrettyPrint", true);
4752
catch e
48-
if e.identifier ~= "MATLAB:json:UnmatchedParameter"
49-
rethrow(e)
53+
switch e.identifier
54+
case {'MATLAB:json:UnmatchedParameter', 'MATLAB:maxrhs'}
55+
json = jsonencode(raw);
56+
otherwise
57+
rethrow(e)
5058
end
51-
52-
json = jsonencode(raw);
5359
end
5460

5561
end

0 commit comments

Comments
 (0)