I’m currently developing a GUI using Matlab and I need to get the directory of the standard document folder of the user. Under windows I use this:
command = 'echo %USERPROFILE%Documents'; [status,docpath] = system(command);
and it works perfectly. Now I planned on doing the same for Linux and Mac with the system(command), but I have no idea what the actual command must look like under these OS. Thanks for your help!
Advertisement
Answer
On Linux the tilde ~
folder is used instead of %USERPROFILE%
.
~
is, usually the,equivalent /home/username
in which you’ll find the ‘Documents’ folder as in your example.
The folder pointed by ‘~’ will be adapted in function of the user.