I have a set : x containing x1,x2.
I take it from an excel sheet using following code:
$call GDXXRW o=x.gdx i=x_data.xlsx trace=3 set=x rng=x_set!a1 rdim=1
$GDXIN x.gdx
$LOAD x
$gdxin
Now I have another subset of x : y(x)
How to import it from excel ? And how should I write it in excel? I tried it similar to the parameter , but I am not able to get it from excel to gams. Can you please help me in this
?
problem writing a subset from excel to gams
-
- User
- Posts: 30
- Joined: 3 years ago
- Location: Ahmedabad
- Contact:
Re: problem writing a subset from excel to gams
Does y expand the set x? If not then you can just do:
If y extends the set x then this is more tricky:
-Michael
Code: Select all
set x; set y(x);
$call GDXXRW o=x.gdx i=x_data.xlsx trace=3 set=x rng=x_set!a1 rdim=1 set=y rng=y_set!a1 rdim=1
$GDXIN x.gdx
$LOAD x y
$gdxin
Code: Select all
set x; set y(x);
$call GDXXRW o=x.gdx i=x_data.xlsx trace=3 set=x rng=x_set!a1 rdim=1 set=y rng=y_set!a1 rdim=1
$GDXIN x.gdx
$LOAD x
* The following merges set y from the GDX file into the set x
$LOADM x=y
$LOAD y
$gdxin