Skip to content

Commit 99167e0

Browse files
committed
Matlab < R2019b compatibility
1 parent 01de948 commit 99167e0

File tree

9 files changed

+19
-21
lines changed

9 files changed

+19
-21
lines changed

+stdlib/allToolboxes.m

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
%% ALLTOOLBOXES tell all the Matlab toolboxes known for this Matlab release
2-
% requires: java
2+
% requires: java, Matlab >= R2018a
33

44
function names = allToolboxes()
55

66
tbx = com.mathworks.product.util.ProductIdentifier.values; %#ok<JAPIMATHWORKS>
77

8-
% R2021a has a bug that requires the comma-separated syntax
98
names = table('Size', [numel(tbx), 2], ...
10-
'VariableTypes',["string", "string"], ...
11-
'VariableNames',["product", "license"]);
9+
'VariableTypes', {'string', 'string'}, ...
10+
'VariableNames', {'product', 'license'});
1211
names.product = string(tbx);
1312

1413
for i = 1:numel(tbx)
@@ -17,4 +16,4 @@
1716

1817
names = sortrows(names);
1918

20-
end
19+
end

+stdlib/get_pid.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
function pid = get_pid()
44

55
if stdlib.matlabOlderThan('R2025a')
6-
pid = feature("getpid");
6+
pid = feature('getpid');
77
else
88
pid = matlabProcessID;
99
end

+stdlib/is_matlab_online.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
function y = is_matlab_online()
77

8-
name = "MW_DDUX_APP_NAME";
8+
name = 'MW_DDUX_APP_NAME';
99
value = "MATLAB_ONLINE";
1010

1111
y = isunix() && ~ismac() && contains(getenv(name), value);

+stdlib/isinteractive.m

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
%% ISINTERACTIVE tell if being run interactively
1+
%% ISINTERACTIVE tell if graphical desktop is being used
2+
%
3+
% "matlab -nodesktop" mode outputs false.
24
%
3-
% we try to consider the "-nodesktop" mode as interactive.
45
% * get(0,'ScreenSize') often isn't relable anymore, it will show a display
56
% size on HPC for example, maybe due to Xvfb or such.
67
% Nowadays (R2025a+) one can make plots without Java enabled -nojvm too.
78

89

910
function g = isinteractive()
1011

11-
if batchStartupOptionUsed()
12+
if ~stdlib.matlabOlderThan('R2019b') && batchStartupOptionUsed()
1213
g = false;
1314
else
1415
g = matlab.desktop.editor.isEditorAvailable() || ...

+stdlib/matlab_bin_path.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
function mpaths = matlab_bin_path()
88

9-
mpaths.arch = computer("arch");
9+
mpaths.arch = computer('arch');
1010
mpaths.root = matlabroot;
1111

1212
mpaths.bin = fullfile(matlabroot, 'bin');

+stdlib/toolbox_used.m

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
% * funUser: all user function files under pkgPath
88

99
function [tbxMathworks, funUser] = toolbox_used(pkgPath)
10-
arguments
11-
pkgPath string
12-
end
1310

1411
[user, mathworks] = matlab.codetools.requiredFilesAndProducts(pkgPath);
1512

scripts/MatlabReleaseUpgrade.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ function MatlabReleaseUpgrade()
4949

5050
function exe = legacy_update_path(name)
5151

52-
r = fullfile(matlabroot, 'bin', computer("arch"));
52+
r = fullfile(matlabroot, 'bin', computer('arch'));
5353
mustBeFolder(r)
5454
exe = fullfile(r, name);
5555

@@ -58,7 +58,7 @@ function MatlabReleaseUpgrade()
5858

5959
function exe = new_update_path(name)
6060

61-
arch = computer("arch");
61+
arch = computer('arch');
6262

6363
if ismac()
6464
head = fullfile(getenv('HOME'), 'Library/Application Support/MathWorks');

test/TestParent.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
classdef (SharedTestFixtures={ matlab.unittest.fixtures.PathFixture(fileparts(fileparts(mfilename('fullpath'))))}, ...
2-
TestTags = {'pure'}) ...
2+
TestTags = {'R2017b'}) ...
33
TestParent < matlab.unittest.TestCase
44

55
properties (TestParameter)
66
p = init_parent()
77
end
88

99

10-
methods (Test, TestTags={'R2019b'})
10+
methods (Test)
1111

1212
function test_parent(tc, p)
1313
pr = stdlib.parent(p{1});

test/TestPlatform.m

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
classdef (SharedTestFixtures={ matlab.unittest.fixtures.PathFixture(fileparts(fileparts(mfilename('fullpath'))))}, ...
2-
TestTags = {'R2019b', 'impure'}) ...
1+
classdef (SharedTestFixtures={ matlab.unittest.fixtures.PathFixture(fileparts(fileparts(mfilename('fullpath'))))}) ...
32
TestPlatform < matlab.unittest.TestCase
43

54
properties
65
CI = getenv('CI') == "true" || getenv('GITHUB_ACTIONS') == "true"
76
end
87

98

10-
methods (Test, TestTags = {'toolbox', 'java'})
9+
methods (Test, TestTags = {'R2018a', 'java', 'toolbox'})
1110
function test_all_toolboxes(tc)
11+
tc.assumeFalse(stdlib.matlabOlderThan('R2018a'))
1212
tc.assumeTrue(stdlib.has_java())
1313
tbx = stdlib.allToolboxes();
1414
tc.verifyClass(tbx, 'table')
@@ -52,6 +52,7 @@ function test_platform_tell(tc)
5252

5353

5454
function test_perl(tc)
55+
tc.assumeFalse(stdlib.matlabOlderThan('R2018a'))
5556
tc.verifyNotEmpty(stdlib.perl_exe())
5657
tc.verifyNotEmpty(stdlib.perl_version())
5758
tc.verifyTrue(stdlib.has_perl(), "Matlab docs indicate that Perl should always be available")

0 commit comments

Comments
 (0)