Page 1 of 1

XLexport skips rows?

Posted: Wed Aug 07, 2019 10:14 am
by tuomas
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.

Re: XLexport skips rows?

Posted: Wed Aug 07, 2019 2:16 pm
by Renger
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

Re: XLexport skips rows?

Posted: Wed Aug 07, 2019 2:31 pm
by tuomas
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.

Re: XLexport skips rows?

Posted: Wed Aug 07, 2019 3:09 pm
by Renger
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