XLexport skips rows?

Problems with syntax of GAMS
Post Reply
tuomas
User
User
Posts: 2
Joined: 1 month ago

XLexport skips rows?

Post by tuomas » 1 month ago

Hi,

Simple question from a newbie: when writing a matrix to an excel file with xlexport, some rows are left missing. This can be seen from row indices that jump from e.g. i37 to i39 in consecutive rows.

Does this have something to do with xlexport's (missing) ability to export zeros?

Apologies if this is a worn topic - pointers at least appreciated.

User avatar
Renger
Posts: 378
Joined: 3 years ago

Re: XLexport skips rows?

Post by Renger » 1 month ago

Hi
If you are a newbie, I would strongly suggest to use the gdxxrw tool instead of xlexport, as gdxxrw has many more features.
Although xlexport is a great tool, it is superseded by gdxxrw (xlexport was developed in 1999 and the actual version is from 2002).
Cheers
Renger
____________________________________
Enjoy modeling even more: The lazy economist

tuomas
User
User
Posts: 2
Joined: 1 month ago

Re: XLexport skips rows?

Post by tuomas » 1 month ago

I am trying to use a code made by someone else. I already verified that zero rows are omitted by xlexport (why on earth?)

best.

User avatar
Renger
Posts: 378
Joined: 3 years ago

Re: XLexport skips rows?

Post by Renger » 1 month ago

Even then you should replace xlexport.
But to answer your question, if a parameter has a value of zero, it is not exported. In order to have this zero exported, you should add EPS (The special value EPS is numerically equal to zero, so when used in the context of numerical comparisons, it behaves as zero).

In your code, you should write, for example:

Code: Select all

myparameter(i) = a(i) - b(i) + EPS;

If myparam becomes zero, xlexport will export it as EPS.

CHeers
Renger
____________________________________
Enjoy modeling even more: The lazy economist

Post Reply