I'm trying to use a Cobra toolbox (in matlab code) in Jupyter Python notebook.
But I have an error using pymatbrigde.
I can connect matlab using magic command
%load_ext pymatbridge
Starting MATLAB on ZMQ socket ipc:///tmp/pymatbridge-b2ebed23-7ab3-4368-8fec-652a366b03b5
Send 'exit' command to kill the server
...........MATLAB started and connected!
I also can read a model test:
import cobra.test
m = cobra.test.create_test_model("textbook")
But model_to_pymatbridge doesn't work, and I can't parse the matlab model object to python format.
from cobra.io.mat import model_to_pymatbridge
model_to_pymatbridge(model, variable_name="modelTest")
AttributeError Traceback (most recent call last)
in ()
1 from cobra.io.mat import model_to_pymatbridge
----> 2 model_to_pymatbridge(m, variable_name="model")
/home/user/anaconda2/lib/python2.7/site-packages/cobra/io/mat.pyc in model_to_pymatbridge(model, variable_name, matlab)
288 matlab = get_ipython().magics_manager.registry["MatlabMagics"].Matlab
289 model_info = create_mat_dict(model)
**--> 290 S = model_info["S"].todok()**
291 model_info["S"] = 0
292 temp_S_name = "cobra_pymatbridge_temp_" + uuid4().hex
**AttributeError: 'numpy.ndarray' object has no attribute 'todok'**
I will be grateful for any help you can provide.
Thank you in advance for your time.
Hello
I'm trying to use a Cobra toolbox (in matlab code) in Jupyter Python notebook. But I have an error using pymatbrigde.
I can connect matlab using magic command
I also can read a model test:
But model_to_pymatbridge doesn't work, and I can't parse the matlab model object to python format.
AttributeError Traceback (most recent call last)