我想在matlab中获得一个相对路径(例如'c:/users/thisuser/thatfolder')。我在Unix机器上阅读了您可以使用的〜,但是我正在使用Windows系统。
有解决方法吗?感谢
您可以使用函数system
:
例如
[~,cmdout] = system('echo %APPDATA%')
应该给您完整的AppData路径。
您可以使用:
获得一般的Windows Env设置userFolder = getenv ( 'userprofile' )
因此,要获得THATFOLDER
使用:
fullfile ( userFolder, 'THATFOLDER' )
一行:
fullfile ( getenv ( 'userprofile' ), 'THATFOLDER' );