<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Using the COBRA toolbox with cobrapy
This example demonstrates using COBRA toolbox commands in MATLAB from python through pymatbridge.
Step1:  The model_to_pymatbridge function will send the model to the workspace with the given variable name.
Step2:  Now in the MATLAB workspace, the variable name 'model' holds a COBRA toolbox struct encoding the model.
Step3:  First, we have to initialize the COBRA toolbox in MATLAB.
Step4:  Commands from the COBRA toolbox can now be run on the model
Step5:  FBA in the COBRA toolbox should give the same result as cobrapy (but maybe just a little bit slower 
<ASSISTANT_TASK:>
Python Code:
%load_ext pymatbridge
import cobra.test
m = cobra.test.create_test_model("textbook")
Explanation: Using the COBRA toolbox with cobrapy
This example demonstrates using COBRA toolbox commands in MATLAB from python through pymatbridge.
End of explanation
from cobra.io.mat import model_to_pymatbridge
model_to_pymatbridge(m, variable_name="model")
Explanation: The model_to_pymatbridge function will send the model to the workspace with the given variable name.
End of explanation
%%matlab
model
Explanation: Now in the MATLAB workspace, the variable name 'model' holds a COBRA toolbox struct encoding the model.
End of explanation
%%matlab --silent
warning('off'); % this works around a pymatbridge bug
addpath(genpath('~/cobratoolbox/'));
initCobraToolbox();
Explanation: First, we have to initialize the COBRA toolbox in MATLAB.
End of explanation
%%matlab
optimizeCbModel(model)
Explanation: Commands from the COBRA toolbox can now be run on the model
End of explanation
%time
m.optimize().f
Explanation: FBA in the COBRA toolbox should give the same result as cobrapy (but maybe just a little bit slower :))
End of explanation
<END_TASK>