Output su excel Topic is solved

Problems with syntax of GAMS
Post Reply
RZoro95
User
User
Posts: 11
Joined: 2 years ago

Output su excel

Post by RZoro95 »

Hi everyone, I have a problem with the output of a result on an excel sheet. In practice I have x (s, i) as a result of the model and I would like me to output them on excel sheet only that I can't. The reason is that they are two indices? I am attaching a photo of the lst result of what to bring to excel.
prova.PNG
i try like this:
solve portafoglio1 maximizing z using rmip;
display z.l, x.l;

execute_unload "PortfolioComp.gdx";

execute "gdxxrw PortfolioComp.gdx o=PorioComp.xls par=x rng=foglio1!a1 cdim=1 rdim=1 "


it just doesn't create any excel sheets for me. In the compiler it gives me this error message:
*** Keyword does not match symbol type, Symbol: x

Any changes made to the spreadsheet were not saved


could someone help me?
GFA
User
User
Posts: 50
Joined: 5 years ago

Re: Output su excel

Post by GFA »

Hi RZoro95,

In your GDXXRW-call you are refering to a parameter "x":
execute "gdxxrw PortfolioComp.gdx o=PorioComp.xls par=x rng=foglio1!a1 cdim=1 rdim=1 "

However, in your model "x" is declared a a variable, hence the error.

To solve this, change par to var:
execute "gdxxrw PortfolioComp.gdx o=PorioComp.xls var=x rng=foglio1!a1 cdim=1 rdim=1 "

Hope this helps.

Regards,
GFA
RZoro95
User
User
Posts: 11
Joined: 2 years ago

Re: Output su excel

Post by RZoro95 »

GFA wrote: 2 years ago Hi RZoro95,

In your GDXXRW-call you are refering to a parameter "x":
execute "gdxxrw PortfolioComp.gdx o=PorioComp.xls par=x rng=foglio1!a1 cdim=1 rdim=1 "

However, in your model "x" is declared a a variable, hence the error.

To solve this, change par to var:
execute "gdxxrw PortfolioComp.gdx o=PorioComp.xls var=x rng=foglio1!a1 cdim=1 rdim=1 "

Hope this helps.

Regards,
GFA
Yeah it worked....thanks a lot Mate !! :D
Post Reply