Dear all,
It's correct while I using $CALL GDXXRW.exe to reading two-dimensional data from excel file. However, when I want to read "four-dimensional data" from excel file, an error occurred.
the Gams code are as follows:
$CALL GDXXRW.exe x2017b.xlsx par=SAM rng=A1:E5 rdim=1 cdim=1
$GDXIN x2017b.gdx
sets u /BT, SE, NE, AGRI, INDU, SERV/
r(u) /BT, SE, NE/
i(u) /AGRI,INDU, SERV/ ;
Alias (i,j),(r,s);
Parameter SAM(*,*,*,*);
$LOAD SAM
$GDXIN
display SAM;[/i][/i]
the error log is,
*** Error 495 in E:\2017 ...\for try 1.gms
Load dimension are different
--- for try 1.gms(15) 3 Mb 2 Errors
*** Error 141 in E:\2017 ...\for try 1.gms
Symbol neither initialized nor assigned
A wild shot: You may have spurious commas in the explanatory
text of a declaration. Check symbol reference list.
--- for try 1.gms(19) 3 Mb 2 Errors
the excel file is.
dummy BT.AGRI BT.INDU SE.AGRI SE.INDU
BT.AGRI 1 2 0.3 0.8
BT.INDU 2 1 0.8 1.3
SE.AGRI 0.6 0.5 1 0.9
SE.INDU 1.8 1.3 2.6 2.3
It would be appreciative if you can give me a help.
Waiting for your reply.
Thanks in advance.
Other Gams code for reading four-dimensional data form excel is also welcome, and thank you very much.
Error while reading four-dimensional data form excel Topic is solved
Re: Error while reading four-dimensional data form excel
Hi Ceepbit
You shouldn't use the dot-notation. Every set element should be in its own cell in excel. In your case:
The gdxxrw command will then be:
Two sets are found in the rows (rdim=2), two sets are found in the columns (cdim=2) and your range is one row bigger.
You could also put three set elements in the row and just one in the columns: rdim=3 cdim=1
Hope this helps
Renger
You shouldn't use the dot-notation. Every set element should be in its own cell in excel. In your case:
Code: Select all
BT
AGR
AGRI INDU 1
Code: Select all
$CALL GDXXRW.exe x2017b.xlsx par=SAM rng=A1:E6 rdim=2 cdim=2
You could also put three set elements in the row and just one in the columns: rdim=3 cdim=1
Hope this helps
Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist
Enjoy modeling even more: Read my blog on modeling at The lazy economist
Re: Error while reading four-dimensional data form excel
Hi Renger,
Thank you very much for your suggestion. It is very useful.
Thank you very much for your suggestion. It is very useful.