Page 1 of 1

Output su excel

Posted: Tue Jan 18, 2022 10:27 am
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?

Re: Output su excel

Posted: Wed Jan 19, 2022 2:26 pm
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

Re: Output su excel

Posted: Fri Jan 21, 2022 9:10 am
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