error: printFluxVector

50 views
Skip to first unread message

bs2019

unread,
Mar 31, 2023, 9:39:17 AM3/31/23
to COBRA Toolbox
Hi Cobra Toolbox Users,

I recently installed the R2022b matlab, cobratoolbox-master, and mosek. I could run the 'optimizeCbModel' function and get the 'FBAsolution.x' with the 'ecoli_core_model'. But, when I wanted to print the fluxes using the 'printFluxVector' function I get the following error:
>> printFluxVector(model,FBAsol.x,true)
Index in position 2 exceeds array bounds. Index must not exceed 1.

Error in printFluxVector (line 96)
labels(:,2) = pad(labels(:,2));

Any help on this issue would be highly appreciated. Thanks!!

BS

dtusso

unread,
May 11, 2023, 9:16:15 PM5/11/23
to COBRA Toolbox
Hello Everyone

I get the same error. Anyone does know how can we solve it? 

Thanks

B. Sen

unread,
May 12, 2023, 1:27:04 AM5/12/23
to cobra-...@googlegroups.com
Hi!
After I had a closer look at the script printFluxVector, I found that in line 96 if we use the following code then it prints the fba solution vector:
labels(:,1) = pad(labels(:,1));

Let me know if that solves the problem.

--

---
You received this message because you are subscribed to a topic in the Google Groups "COBRA Toolbox" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cobra-toolbox/pl-c_2OTeZ8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cobra-toolbo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cobra-toolbox/16c5b05b-7b1d-48f0-bcef-6dd152848ee5n%40googlegroups.com.

Ronan M.T. Fleming

unread,
May 12, 2023, 3:21:46 AM5/12/23
to cobra-...@googlegroups.com
Hi Ben, et al,
I've repaired printFluxVector now. The update is in the master branch
Can you please test it to see if it works for you?
Regards,
Ronan

You received this message because you are subscribed to the Google Groups "COBRA Toolbox" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cobra-toolbo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cobra-toolbox/CAG_aCenNG_Z4iywH_4kRWFBjxfShd7Z5FbXRy3j_KXcuve6Dkw%40mail.gmail.com.


--
--
Mr. Ronan MT Fleming B.V.M.S. Dip. Math. Ph.D.
----------------------------------------------------------------------------
Associate Professor,
School of Medicine,
National University of Ireland, Galway.
&
Assistant Professor,
Division of Systems Biomedicine and Pharmacology,
Leiden Academic Centre for Drug Research,
Faculty of Science,
Leiden University.
&
Coordinator of the Horizon Europe project "Reconstruction and Computational Modelling for Inherited Metabolic Diseases" (Recon4IMD)
----------------------------------------------------------------------------
Peer-reviewed publications: https://goo.gl/FZPG23
Mobile:  +353 852 109 806
Skype: ronan.fleming
----------------------------------------------------------------------------
(This message is confidential and may contain privileged information. It is intended for the named recipient only. If you receive it in error please notify me and permanently delete the original message and any copies.)

bs2019

unread,
May 12, 2023, 4:51:53 AM5/12/23
to COBRA Toolbox
Hi Ronan,
With your repaired printFluxVector.m, it prints the fluxes when only nonZeroFlag and excFlag are set to true or false. However, when I also set the formulaFlag and gprFlag as true, I get the following error:
>> printFluxVector(model, FBA.solution.x, true,true,true,true);
Error using fopen
First input must be a file name or a file identifier.

Error in printLabeledData (line 56)
        fid = fopen(fileName, 'a');%change to append by default, in case something already there

Error in printFluxVector (line 100)
printLabeledData(labels, fluxData, 0, sortCol, fileName, headerRow)

Ronan M.T. Fleming

unread,
May 12, 2023, 5:30:13 AM5/12/23
to cobra-...@googlegroups.com
Hi Ben,
please check that input, fopen was expecting a filename.
Regards,
Ronan

bs2019

unread,
May 13, 2023, 12:24:11 AM5/13/23
to COBRA Toolbox
Hi Ronan,
I am still getting the same error despite providing a filename as another input. Can I have a look at the line of code that works for you and prints the reaction formula and the gpr? May be I am missing out something. Thanks.

dtusso

unread,
May 16, 2023, 4:42:53 PM5/16/23
to COBRA Toolbox
Hello Ronan

It works for me printing only nonZeroFlag and excFlag.

Thank you.

Reply all
Reply to author
Forward
0 new messages