MATLAB: What is the format to write to a file not in the MATLAB directory.

format files not in current foldermac

I have macOS 12.14.2 Mohave using MATLAB Home.
What is the format to write to a file not in the MATLAB directory. I have a KINGSTON flash drive and I use
c=[1.1 2.2 3.3 4.4 5.5];
e=[15.5 16.6 17.7 18.8 19.9];
fid = fopen('\KINGSTON\test1.txt','w')
fprintf(fid,'%6.2f %8.4f\n',c,e);
fclose(fid)
The file is not created on the KINGSTON drive. I get fid=3.
If I use fid = fopen('test1.txt','w') the file is created in the current folder. What am I doing wrong?

Best Answer

This is a great question. I don't have a flash drive handy to try this, but you might need to mount the flash drive to make it accessible from the file system and MATLAB. Here is a web page on how to do this:
That might be enough. However, there is also the further possibility that, to make this mount visibile to MATLAB, you might also need to launch MATLAB from the Terminal window created above. The command to do this from Terminal will be something like this:
open -a "/Applications/MATLAB R2018b.app/"
Hope this helps.
If all of this is too much hassle, the poor man's solution is to write your files to some place that is more readily accessible, and then later manaully move/copy those files to the flash drive using Finder.