Many thanks for your advice and the files you provide.

Unluckily, the compress flag does not solve the problem. This option in the rgdx routine allows a user to remove ALL rows and ALL columns with all zeros from the ‘val’ data matrix but SOME of those rows are desired. Let me explain with the example from above: reading a variable that is only defined in dimensions i,j, and obtaining a k-x-k-matrix, while what is desired is only the sensible data for the i-x-j-submatrix, the compress tag would delete rows and columns in the submatrix that are zero even though they may be sensible data from the optimal solution of that variable…

Cheers,

+i

On Wednesday, June 6, 2012 6:30:38 PM UTC+1, Michael Ferris wrote:

There is an option for that!

I attach below a data file, and a readSparse.m file that we use for testing (its a bit verbose but shows what we expect to get back, and then checks we do in fact get it back from the rgdx call). It shows how to use the compress feature and lots of other options in the reading of gdx files into matlab via rgdx.

The key lines for you are (I believe):

clear rFlags;

rFlags.name = ‘I’;

r = rgdx (‘readFull.gdx’, rFlags);

r.uels{1}

then has the 14 or so uels that are in the “global uel list” from the readFull.gdx file.

If you add the “compress” flag, then the interface squashes out those uels.

rFlags.compress = ‘true’;

r = rgdx (‘readFull.gdx’, rFlags);

r.uels{1}

gives what I think you wanted. You may want to experiment with some other more complex sets or parameters to ensure you get back what you are expecting.

Cheers, Michael

On Jun 6, 2012, at 11:34 AM, imo wrote:

Hi,

I am working with a GAMS MatLab hybrid via gdx for interfacing. Specifically with: rgdx() and wdgx().

When reading the GAMS output in Matlab with rgdx() I obtain very sparse data that contains lots of 0s. To be more specific I noticed that data is just filled up to the number of elements corresponding to the largest set. That is to say, if I have three sets i,j,k with cardinality Ni

Many thanks for any advice.

-imo

–

To view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/GVF4vIHyZT0J.

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 view this discussion on the web visit https://groups.google.com/d/msg/gamsworld/-/1AH_gxPMC0AJ.

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.