I run Matlab on an Intel MACPro through X11 in OSC and through a vista virtual machine using Parallels. This program simplifies directory switching so I can easily access the virtual drives created by Parallels.
Parallels creates a directory in '/tmp' that provides access to any virtual drives. This directory is always numeric and changes whenever parallels is restarted. Thus, the script must be able to search for the proper directory. This code supplies two simple methods for achieving that goal.
R=dir('/tmp'); % Get directory names
for n=1:length(R), % Scan through directory names
R1=exist(['/tmp/', R(n).name, '/C/']); % See if the directory exists.
if R1==7, % Exist returns 7 if A is a directory
eval(['cd /tmp/', R(n).name, '/C/']); % Go to the appropriate directory
break, end % Program is finished
Geoffrey (2020). ParallelC (https://www.mathworks.com/matlabcentral/fileexchange/25832-parallelc), MATLAB Central File Exchange. Retrieved .
Put code into description.
Changed the file to a function so it relies only on local variables.