|
Loading the set into GAMS |
Top Previous Next |
|
Getting a set from the spreadsheet into a GDX file is only half the battle. One must also use commands in GAMS to load the data as discussed in the chapter Using GAMS Data Exchange or GDX Files. At compile time this is done using (Gdxxrwread.gms)
set i1; $call "Gdxxrw gdxxrwss.xls set=i1 Rng=sheet1!a2:c2 cdim=1" $GDXin gdxxrwss.gdx $load i1
where the set must be declared in a set statement then one can if needed create the GDX file using GDXRW, then one uses a Gdxin to identify the source and a Load to bring in the data. At execution time one does the following (Gdxxrwread.gms)
set i9(i6a); *set from data execute "Gdxxrw gdxxrwss.xls set=i9 Rng=sheet1!b20:c21 cdim=1" Execute_load 'gdxxrwss' i9;
where the set must be declared as a subset in a set statement then one can if needed create the GDX file using execution time GDXRW, and an Execute_Load to bring in the data with an identification of the GDX source file name. |