Numpy to matlab interface with mlabwrap

I am looking for an easy way to visualize some of my data in numpy, and I have discovered a mlabwrap package that looks really promising. I am trying to create a simple plot with the ability to update as the data changes.

Here is the matlab code I'm trying to duplicate

 >> h = plot([1,2,3], [1,2,3], '-o'); >> set(h, 'XData', [0,0,0]); >> drawnow(); 

for python

 >> from mlabwrap import mlab >> h = mlab.plot([1,2,3], [1,2,3], '-o') >> mlab.set(h, 'XData', [0,0,0]) >> mlab.drawnow(); 

However, the second with the last command does not work with the error message

 error: One or more output arguments not assigned during call to "set". 

Any suggestions on how to fix this?

+6
python interface matlab
source share
2 answers

Perhaps mlab is crazy that you are not saving the matlab return value for this set () call ...

I have not installed this, which gives someval = mlab.set(h,'XData') ?

edit: you can also try using nout ... mlab.set(h,'XData',[0,0,0],nout=0)

+6
source share

Since set does not accept output arguments, we need to tell mlabwrap that it should not output any output arguments to avoid the error message above.

 mlab.set(h, 'XData', [0,0,0], nout=0) 
+5
source share

All Articles