Why is my MATLAB Python Package returning the wrong current directory?
이전 댓글 표시
I am compiling the following MATLAB function into a Python Package:
function showpwd()
disp("MATLAB Time")
pwd
end
When I call showpwd in a Python script, it returns a different directory than the one that it has been called from. Furthermore, after calling this function, Python has changed its current directory. See the Python script and output below:
from __future__ import print_function
import showpwd
import matlab
import os
print(os.getcwd())
my_showpwd = showpwd.initialize()
my_showpwd.showpwd(nargout=0)
my_showpwd.terminate()
print(os.getcwd())
Output:
MATLAB Time
ans =
'userName\Documents\MATLAB\myDir'
Before MATLAB is called: userName\Documents\MATLAB\myDir\showpwd\for_redistribution_files_only\samples
After MATLAB is called: userName\Documents\MATLAB\myDir
Why is this happening and how can I resolve this?
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Python Package Integration에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!