Page 1 of 1

Running GAMS from MATLAB

Posted: Wed Mar 06, 2019 8:11 pm
by masoudkavoosi
hey guys,

I am trying to call GAMS from a MATLAB code. I have done this a lot of times before, but this time it returns an error that I cannot solve it.

MATLAB returns the error below:

Error using gams
Could not write data with gdxDataWriteMapStart

Error in UIMA_GAMS (line 51)

My files have been attached. It would be greatly appreciated if you check it and help me. As I cannot attach an m-file here, I changed the extension of the file UIMA_GAMS.m to .gms and attach it. Please kindly change the extension to .m to use the file.

Thank you


Re: Running GAMS from MATLAB

Posted: Thu Mar 07, 2019 4:00 pm
by dirkse

I would advise you not to use the gams Mex-function. It's nice when it works, but if there is any error - and the error state is the normal state when you're developing a model or source code anywhere - it doesn't help you find and fix the error. In your example, where should you start looking? The Matlab code? The GAMS source you wrote? The GAMS source written by the gams Mex-function?

You can find some suggestions - I would say good and helpful ones - about a better way to do this on the GAMS wiki page about GDXMRW: ... and_matlab

BTW, if you choose to persist in using the gams Mex-function, you should start by removing the space from the name of the Pv and Ph parameters. This won't work:

Code: Select all' Pv';


Re: Running GAMS from MATLAB

Posted: Thu Mar 07, 2019 4:32 pm
by masoudkavoosi
Hi, Steve.

Thank you so much for your attention. My problem was about that space that you correctly have mentioned. I should have been more attentive.

Thank you again