How do I get the MATLAB current directory in mex code?

1 次查看(过去 30 天)
In matlab it would be pwd, but in mex code, how would I find out?

回答(1 个)

Jan
Jan 2015-1-30
编辑:Jan 2015-1-30
The current folder inside the MEX file is the same as in Matlab. So you can use the standard C command getcwd to obtain the current directory. A modern version is _getcwd or if you are using the boost libs: current_path(). Under Windows the GetCurrentDirectory is sufficient also and can handle Unicode filenames in addition, but is depends on the platform.

类别

Help CenterFile Exchange 中查找有关 Write C Functions Callable from MATLAB (MEX Files) 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by