read data from excel file

Hello All,

I am trying to read parameters data from an excel file but I am getting an error (Load dimension are different).

I do not know if there is any influence but I specify A1:A42 but in the error log it mentions A2.:A42 !

Any ideas what could be wrong?

Thank you, Cheers,
Hugo Caçote


------------------Model----------
sets

j “product numbers” /142/
t “increment sensitivity” /1
5/;

parameter r(j) “rounding value” ;

$CALL GDXXRW Rounding.xls par=r rng=A1:A42 trace=3
$GDXIN Rounding.gdx
$LOAD r
$GDXIN
display r;
--------------Error--------------------

— Starting compilation
— pfizerV8-0-Int-V01-recurse-excel.gms(7) 2 Mb
— call msappavail -Excel
— pfizerV8-0-Int-V01-recurse-excel.gms(71) 3 Mb
— call GDXXRW Rounding.xls par=r rng=A1:A42 trace=3
GDXXRW Mar 17, 2012 23.8.2 WIN 31442.32372 VS8 x86/MS Windows
Excel version 14.0
Input file : Z:\cacoteh\Desktop\GamsReporting\Rounding.xls
Output file: Z:\cacoteh\Desktop\GamsReporting\Rounding.gdx
Type Symbol Dim Sheet Data RowHeader ColHeader
Loading sheet Sheet1
Reading data from Excel: Width = 1 Height = 42
Par r 2 Sheet1 --:-- A2:A42 --:–
Total time = 920 Ms
— pfizerV8-0-Int-V01-recurse-excel.gms(72) 3 Mb
— GDXin=\GVECSM0001DATA.ds.givaudan.com\homedir$\cacoteh\Desktop\GamsReporting\Rounding.gdx
— pfizerV8-0-Int-V01-recurse-excel.gms(73) 3 Mb 1 Error
*** Error 495 in \GVECSM0001DATA.ds.givaudan.com\homedir$\cacoteh\Desktop\LotSizeGams\pfizerV8-0-Int-V01-recurse-excel.gms
Load dimension are different

\

To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/s9gKb7t9cNkJ.
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

Hi Hugo

You define a parameter over a set j, so you should at least read in the set member AND the value.

How would GAMS know to which set element it should assign the value in your one dimensional table…?

Therefore, your table should look like this with the elements of j in column A and the values in B

A B

1 0.2

2 0.4

Etc.,

Furthermore, you should tell GAMS that it is a parameter defined over one set using Rdim=1

$CALL GDXXRW Rounding.xls par=r rng=A1:A42 rdim=1 trace=3

Take a good look at the examples in the gdx-manual to understand the rdim and cdim (it is a little bit counter intuitive).

Cheers


Renger



From: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] On Behalf Of Hugo Caçote
Sent: Wednesday, July 11, 2012 5:08 PM
To: gamsworld@googlegroups.com
Subject: read data from excel file



Hello All,



I am trying to read parameters data from an excel file but I am getting an error (Load dimension are different).



I do not know if there is any influence but I specify A1:A42 but in the error log it mentions A2.:A42 !



Any ideas what could be wrong?



Thank you, Cheers,

Hugo Caçote





------------------Model----------

sets

j “product numbers” /142/
t “increment sensitivity” /1
5/;



parameter r(j) “rounding value” ;



$CALL GDXXRW Rounding.xls par=r rng=A1:A42 trace=3
$GDXIN Rounding.gdx
$LOAD r
$GDXIN

display r;

--------------Error--------------------



— Starting compilation
— pfizerV8-0-Int-V01-recurse-excel.gms(7) 2 Mb
— call msappavail -Excel
— pfizerV8-0-Int-V01-recurse-excel.gms(71) 3 Mb
— call GDXXRW Rounding.xls par=r rng=A1:A42 trace=3

GDXXRW Mar 17, 2012 23.8.2 WIN 31442.32372 VS8 x86/MS Windows
Excel version 14.0
Input file : Z:\cacoteh\Desktop\GamsReporting\Rounding.xls
Output file: Z:\cacoteh\Desktop\GamsReporting\Rounding.gdx
Type Symbol Dim Sheet Data RowHeader ColHeader
Loading sheet Sheet1
Reading data from Excel: Width = 1 Height = 42
Par r 2 Sheet1 --:-- A2:A42 --:–
Total time = 920 Ms
— pfizerV8-0-Int-V01-recurse-excel.gms(72) 3 Mb
— GDXin=\GVECSM0001DATA.ds.givaudan.com\homedir$\cacoteh\Desktop\GamsReporting\Rounding.gdx
— pfizerV8-0-Int-V01-recurse-excel.gms(73) 3 Mb 1 Error
*** Error 495 in \GVECSM0001DATA.ds.givaudan.com\homedir$\cacoteh\Desktop\LotSizeGams\pfizerV8-0-Int-V01-recurse-excel.gms
Load dimension are different


\

To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/s9gKb7t9cNkJ.
To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.


To post to this group, send email to gamsworld@googlegroups.com.
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en.

Thanks Renger, you saved my day with your explanation : )

On Wednesday, July 11, 2012 5:08:06 PM UTC+2, Hugo Caçote wrote:

Hello All,

I am trying to read parameters data from an excel file but I am getting an error (Load dimension are different).

I do not know if there is any influence but I specify A1:A42 but in the error log it mentions A2.:A42 !

Any ideas what could be wrong?

Thank you, Cheers,
Hugo Caçote


------------------Model----------
sets

j “product numbers” /142/
t “increment sensitivity” /1
5/;

parameter r(j) “rounding value” ;

$CALL GDXXRW Rounding.xls par=r rng=A1:A42 trace=3
$GDXIN Rounding.gdx
$LOAD r
$GDXIN
display r;
--------------Error--------------------

— Starting compilation
— pfizerV8-0-Int-V01-recurse-excel.gms(7) 2 Mb
— call msappavail -Excel
— pfizerV8-0-Int-V01-recurse-excel.gms(71) 3 Mb
— call GDXXRW Rounding.xls par=r rng=A1:A42 trace=3
GDXXRW Mar 17, 2012 23.8.2 WIN 31442.32372 VS8 x86/MS Windows
Excel version 14.0
Input file : Z:\cacoteh\Desktop\GamsReporting\Rounding.xls
Output file: Z:\cacoteh\Desktop\GamsReporting\Rounding.gdx
Type Symbol Dim Sheet Data RowHeader ColHeader
Loading sheet Sheet1
Reading data from Excel: Width = 1 Height = 42
Par r 2 Sheet1 --:-- A2:A42 --:–
Total time = 920 Ms
— pfizerV8-0-Int-V01-recurse-excel.gms(72) 3 Mb
— GDXin=\GVECSM0001DATA.ds.givaudan.com\homedir$\cacoteh\Desktop\GamsReporting\Rounding.gdx
— pfizerV8-0-Int-V01-recurse-excel.gms(73) 3 Mb 1 Error
*** Error 495 in \GVECSM0001DATA.ds.givaudan.com\homedir$\cacoteh\Desktop\LotSizeGams\pfizerV8-0-Int-V01-recurse-excel.gms
Load dimension are different

\

To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.
To post to this group, send email to gamsworld@googlegroups.com.
Visit this group at http://groups.google.com/group/gamsworld?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

\