I'd like to get a relative path in matlab (eg 'C:/Users/thisuser/THATFOLDER'). I read on unix machines you may use ~, however I'm working on a windows system.
Is there a workaround? Appreciated
You can get the full path by using the function system
:
For example
[~,cmdout] = system('echo %APPDATA%')
Should give you the full appdata path.
You can get general windows env settings using:
userFolder = getenv ( 'userprofile' )
so to get THATFOLDER
use:
fullfile ( userFolder, 'THATFOLDER' )
In one line:
fullfile ( getenv ( 'userprofile' ), 'THATFOLDER' );
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.