No License

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

» Watch video

Highlights from
Get user home directory

4.4 | 8 ratings Rate this file 5 Downloads (last 30 days) File Size: 590 Bytes File ID: #15885 Version: 1.0

Get user home directory


Sven Probst (view profile)


10 Aug 2007 (Updated )

get the user's home directory platform independent

| Watch this File

File Information

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

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

MATLAB release MATLAB 7.3 (R2006b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (9)
16 Jan 2017 Yona

Yona (view profile)

very useful

24 Apr 2015 David Young

David Young (view profile)

06 Nov 2014 Michael Kutzer

16 Oct 2014 David

David (view profile)

16 Oct 2014 David

David (view profile)


08 Feb 2012 Eric

Eric (view profile)

10 Aug 2008 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).

23 Jul 2008 andy a

Why not just this

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

Comment only
19 Feb 2008 Javier Lopez


Contact us