MATLAB: How to create a user defined search PATH when MATLAB executes on a Citrix server with multiple users

addpathcitrixdesignatedgroupMATLABsessionsetpath

MATLAB session(s) runs on a Citrix server. Multiple GROUP users can log in on the Citrix server to use a MATLAB session. In the default settings there exists one search PATH definition. For each MATLAB user an own search PATH definition has to be defined in the MATLAB/Citrix environment.

Best Answer

To define for each user a search PATH definition for a MATLAB session running on a Citrix server, the STARTUP.M file has to be modified. Citrix commands can be added which roots to a predefined ‘user_path.m’ file. The ‘user_path.m’ file is stored on a user directory and will set the user search PATH definition.
Solution overview:
MATLAB session starts on a Citrix server --> ‘startup.m’ roots to a user directory on the Citrix server and runs a ‘user_path.m’ --> ‘user_path.m’ will set the user search PATH definition
Reproduction steps:
The ‘startup.m’ can be found in ‘$MATLABROOT\toolbox\local\startup.m’ (where $MATLABROOT is the MATLAB root directory on your machine, as returned by typing:
matlabroot
in the MATLAB command window). If the ‘startup.m’ file does not exist it has to be created in this location.
The ‘startup.m’ file can be modified with Citrix commands to locate the ‘user_path.m’ file:
tmp = pwd;
cd(\\serverx\%hom_share%\Matlab);
run('user_path');
cd(tmp);
The ‘user_path.m’ is stored on a unique location on the Citrix server per user, such as:
\\serverx\%hom_share%\Matlab
The ‘user_path.m’ file contains the desired PATH's definitions of the user, for example:
addpath user_files
addpath user_data
For each user a ‘user_path.m’ file has to be created with the same file name and stored in the unique location on the Citrix server.