I have isolated a problem writing to Matlab workspace via matlab.engine in Python. Can anyone assist?
Whenever I call eng.workspace, I 'time out', that is that Matlab goes in to an infinite busy and fails to continue with the script, either in Python or Matlab, in fact it never leaves the eng.workspace call.
When I ctrl-c out the command is still executed and the variable stored in the matlab workspace, yet nothing after that line is executed.
Code for context:
%In Matlab
%Share the current Matlab Session
testShared = matlab.engine.isEngineShared;
if ~testShared
matlab.engine.shareEngine('MATLABShared001');
end
%Call the python script
disp('Starting call to Python Script')
cmdString = 'python test.py';
status = system(cmdString);
disp('Finished call to Python')
#In Python
import matlab.engine
names = matlab.engine.find_matlab()
eng = matlab.engine.connect_matlab(names[0])
eng.workspace['abcd'] = 10
eng.workspace['test'] = 'it worked!'
#No need to quit as python auto closes at end (and problem is before this)
If this python script is run manually (pyCharm or cmd\python) then everything runs perfectly and the two variables are perfectly located in the matlab workspace. However, when run programmatically from matlab, it gets caught in the first eng.workspace and does not continue.
Output (Matlab) : Matlab Command Window and Workspace Results of Ctrl-C Termination
Any help is appreciated.
edit: Turned it into a question, not a statement