File Exchange

image thumbnail

Get user home directory

version 1.0 (590 Bytes) by

get the user's home directory platform independent

4.375
8 Ratings

7 Downloads

Updated

No License

GETUSERDIR returns the user home directory using the registry on windows systems and using Java on non windows systems as a string

COLLABORATION:
As I am not familiar with non windows operating systems please give me information about incompatibilities - I rely on JAVA in this function

Comments and Ratings (9)

Yona

Yona (view profile)

very useful

David Young

David Young (view profile)

David

David (view profile)

David

David (view profile)

thanks!

Eric

Eric (view profile)

Martin O'Reilly

Nice bit of code - just what I was looking for.

@ andy a: getenv('USERPROFILE') gets the root of your Windows profile. By default your "My Documents" folder will be directly under this root. Fowever, getenv('USERPROFILE') will not get your "My Documents" folder if you have changed it from the default (e.g. to another partition to separate data and operating system files).

andy a

Why not just this

if ispc; userdir= getenv('USERPROFILE');
else; userdir= getenv('HOME');
end

Javier Lopez

Nice!

MATLAB Release
MATLAB 7.3 (R2006b)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video