syntax error 148 during Matlab-gams wgdx

Problems with syntax of GAMS
Post Reply
bigakrim
User
User
Posts: 12
Joined: 1 year ago

syntax error 148 during Matlab-gams wgdx

Post by bigakrim » 2 months ago

Hi everyone
I am trying to run gams in Matlab using the command gams. In Matlab, the parameters Q_m, Q_p, R_m and R_p; the set t are updated and write in a gdx so that gams can update them while running and give cost.
but unfortunately, I am having the syntax error 148. It seems that Q_m, Q_p, R_m and R_p are referenced with more or less indices as declared.

Kindly help me find where the syntax error is.

here is the excel file, matlab and gams code.
gams_matlab.txt
(533 Bytes) Downloaded 30 times
data_opt_lookup_inc.xlsx
(2 MiB) Downloaded 33 times
myopic_gams_matlab.gms
(10.01 KiB) Downloaded 34 times

User avatar
dirkse
Moderator
Moderator
Posts: 165
Joined: 5 years ago
Location: Fairfax, VA

Re: syntax error 148 during Matlab-gams wgdx

Post by dirkse » 2 months ago

Hello,

You are passing the data from Matlab to GAMS in two different put essentially parallel ways: once by writing the GDX file via your wgdx() call, and again by passing the data in the gams() call. But these parallel ways to pass the data intersect: you use the file name 'gams_matlab.gdx' in each case. This is wasteful, confusing, and bound to fail.

I recommend you avoid the gams() call in Matlab entirely. Remove the $set matout stuff and anything else that requires the Matlab interface from your GAMS model, and just call GAMS from Matlab via system() or system2(). More on the how and why available here:

https://support.gams.com/matlab_and_gam ... and_matlab

HTH,

-Steve

Post Reply