I am trying to work with matlab through python to prototype a system that I have developed. Is mlabwrap capable of handeling multiprocessing? This may come across as very stupid, but I was thinking I could do the following:
from multiprocessing import Process,Lock
from mlabwrap import mlab
from mlabwrap import mlab as mlab1
def some_Function(mlab,Astring)
#do some stuff....
p1=Process(target=some_Function,args=(mlab,"Example string 1"))
p2=Process(target=some_Function,args=(mlab1,"Example string 2"))
p1.start()
p2.start()
but I keep getting this error:
Traceback (most recent call last):
File "/usr/lib64/python2.6/multiprocessing/process.py", line 232, in _bootstrap
self.run()
File "/usr/lib64/python2.6/multiprocessing/process.py", line 88, in run
self._target(*self._args, **self._kwargs)
File "test.py", line 15, in process_Camera
res=mlab.RetrieveAndProcess(cameraDirectory)
File "/home/mar608/data/cameraSystem/mlabwrap-1.1/build/lib.linux-x86_64-2.6/mlabwrap.py", line 607, in mlab_command
return self._do(name, *args, **update({'nout':nout}, kwargs))
File "/home/mar608/data/cameraSystem/mlabwrap-1.1/build/lib.linux-x86_64-2.6/mlabwrap.py", line 515, in _do
mlabraw.eval(self._session, "cd('%s');" % os.getcwd().replace("'", "''"))
error: Unable to evaluate string in MATLAB(TM) workspace
Note, I do not get this error when I run just the function regularly, even if I run the function once with mlab and again with mlab1. It only happens when I run it as a process, and it happens regardless of whether or not I run another process with it.
Any hints would be greatly appreciated!
Note that this happens for all matlab functions. For instance, calling mlab.sum([2,3]) also gives the same error
NOTE: I know I should not be doing this sort of thing for a final product of my code. I won't be doing this in the final version, I just want to get a demo working.