Skip to content

Commit d17fa71

Browse files
committed
add is_matlab_online()
1 parent 57e42e6 commit d17fa71

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

+stdlib/is_matlab_online.m

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
%% IS_MATLAB_ONLINE check if running in MATLAB Online
2+
% This function is heuristic check using undocumented environment variables.
3+
% These variables have worked across several Matlab releases, but there isn't a guarantee
4+
% that they will always be present or have the same values.
5+
6+
function y = is_matlab_online()
7+
8+
y = isunix() && ~ismac();
9+
if ~y, return, end
10+
11+
h = getenv("MW_DDUX_APP_NAME");
12+
13+
if h == "MATLAB_ONLINE"
14+
y = true;
15+
else
16+
y = false;
17+
end
18+
19+
end

0 commit comments

Comments
 (0)