Reputation: 85
I need to import a scalar (say d=240) number from excel to GAMS.
parameter d;
$CALL GDXXRW mydata.xlsx par=d rng=Sheet1!a1
$GDXIN mydata.gdx
$LOAD d
$GDXIN
display d;
But never display the correct value. Always d=0. I can import a matrix from excel to GAMS easily, but I can not import a scalar number.
Upvotes: 1
Views: 603
Reputation: 371
You can solve this issue by explicitly giving gdxxrw the dimension of the parameter (here 0).
parameter d;
$CALL GDXXRW mydata.xlsx par=d rng=Sheet1!a1 dim=0
$GDXIN mydata.gdx
$LOAD d
$GDXIN
display d;
PS: if you had looked at mydata.gdx, you'd have seen that d was 0 there. Thus, the problem was with gdxxrw.
Upvotes: 1