Skip to content

Commit 9a5dd22

Browse files
committed
Clear variables initialized in matlab_startup_file
1 parent 6465ff2 commit 9a5dd22

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

jupyter_matlab_proxy/matlab/startup.m

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
11
% Copyright 2020-2021 The MathWorks, Inc.
22

33
% Configure logged in user if possible
4-
first_name = getenv('MW_LOGIN_FIRST_NAME');
5-
last_name = getenv('MW_LOGIN_LAST_NAME');
6-
email_address = getenv('MW_LOGIN_EMAIL_ADDRESS');
7-
user_id = getenv('MW_LOGIN_USER_ID');
8-
profile_id = getenv('MW_LOGIN_PROFILE_ID');
9-
display_name = getenv('MW_LOGIN_DISPLAY_NAME');
10-
if (strlength(user_id) > 0)
4+
if ~isempty(getenv('MW_LOGIN_USER_ID'))
5+
user_id = getenv('MW_LOGIN_USER_ID');
6+
first_name = getenv('MW_LOGIN_FIRST_NAME');
7+
last_name = getenv('MW_LOGIN_LAST_NAME');
8+
email_address = getenv('MW_LOGIN_EMAIL_ADDRESS');
9+
profile_id = getenv('MW_LOGIN_PROFILE_ID');
10+
display_name = getenv('MW_LOGIN_DISPLAY_NAME');
11+
1112
li = com.mathworks.matlab_login.MatlabLogin.isUserLoggedIn(2, 'DESKTOP');
1213
token = li.getToken();
1314
login_level = 2;
1415
remember_me = true;
15-
com.mathworks.matlab_login.MatlabLogin.saveCacheLoginInfo(first_name, last_name, email_address, user_id, token, profile_id, login_level, remember_me, email_address, display_name);
16+
com.mathworks.matlab_login.MatlabLogin.saveCacheLoginInfo(first_name, ...
17+
last_name, email_address, user_id, token, profile_id, login_level, ...
18+
remember_me, email_address, display_name);
19+
% Clear all local variables from users workspace.
20+
clear user_id first_name last_name email_address profile_id display_name token remember_me
1621
end
1722

1823
if (strlength(getenv('BASE_URL')) > 0)
@@ -26,4 +31,4 @@
2631
matlab_settings.matlab.addons.explorer.addSetting('isExplorerSupported');
2732
matlab_settings.matlab.addons.explorer.isExplorerSupported.PersonalValue = false;
2833

29-
clear
34+
clear matlab_settings

0 commit comments

Comments
 (0)