GDXMRW problem

Hi,

I have a problem with the function wgdx(). I want save three sets: jcon(j); jint(j); jbin(j), so I created three struct arrays:

s1.name = ‘jcon’; s1.uels = r1’;
s2.name = ‘jint’; s2.uels = r2’;
s3.name = ‘jbin’; s3.uels = r3’;

For example, the struct s1 is:

s1

s1 =

name: ‘jcon’
uels: {1x470 cell}

Then, I used the function wgdx()as follow:

wgdx(‘fileGDX’,s1,s2,s3)

But, error comes saying: “Error using ==> wgdx Input structure field .val must be double matrix”

In the manual of the GDXMRW tool (page 9) appear the following writing set example:

s.name = ‘l’;
s.uels = {{‘i1’, ‘i2’, ‘i3’}, {‘j1’, ‘j2’}};
c.name = ‘par’;
c.type = ‘parameter’;
c.val = eye(3);
c.form = ‘full’;
c.ts = ‘3 x 3 identity’;
wgdx(‘foo’, s, c)

And the struct s don’t have .val field. Somebody know the reason of the error?

Thanks in advance.


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.

Fabian,

You don’t include the full source for your example. If you could cut
it down from 470 elements and include the source for r1 one could give
you better advice about your example.

Also, you could look at the models gdxmrw03, gdxmr04, and gdxmrw05
from testlib. One or more of these will have working code to write a
set via wgdx().

-Steve

2012/4/13 Fabián Mancilla :

Hi,

I have a problem with the function wgdx(). I want save three
sets: jcon(j); jint(j); jbin(j), so I created three struct arrays:

s1.name = ‘jcon’; s1.uels = r1’;
s2.name = ‘jint’; s2.uels = r2’;
s3.name = ‘jbin’; s3.uels = r3’;

For example, the struct s1 is:

s1

s1 =

name: 'jcon'
uels: {1x470 cell}

Then, I used the function wgdx()as follow:

wgdx(‘fileGDX’,s1,s2,s3)

But, error comes saying: “Error using ==> wgdx Input structure field .val
must be double matrix”

In the manual of the GDXMRW tool (page 9) appear the following writing set
example:

s.name = ‘l’;
s.uels = {{‘i1’, ‘i2’, ‘i3’}, {‘j1’, ‘j2’}};
c.name = ‘par’;
c.type = ‘parameter’;
c.val = eye(3);
c.form = ‘full’;
c.ts = ‘3 x 3 identity’;
wgdx(‘foo’, s, c)

And the struct s don’t have .val field. Somebody know the reason of the
error?

Thanks in advance.


“gamsworld” group.
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.



– Steven Dirkse, Ph.D. GAMS Development Corp., Washington DC Voice: (202)342-0180 Fax: (202)342-0181 sdirkse@gams.com http://www.gams.com

Steve, thanks for the help!

The issue is in define s1.uels = r1’. If I define s1.uels = {r1’} the error vanish. Then .uels field is ‘struct of struc’:

s1

s1 =

name: ‘jcon’
uels: {{1x470 cell}}

I don’t know why wgdx() work properly with this definition. Curiously, for exporting a parameter I defined the .uels field just like the first way and I didn’t have any error. For example:

c3.name = ‘b’;
c3.type = ‘parameter’;
c3.val = b;
c3.uels = r1;
c3.form = ‘full’;
c3.ts = ‘Vector b’;

I attached the GDX file obtained, so you can review.

Regards


On Fri, Apr 13, 2012 at 11:15 AM, Steven Dirkse wrote:

Fabian,

You don’t include the full source for your example. If you could cut
it down from 470 elements and include the source for r1 one could give
you better advice about your example.

Also, you could look at the models gdxmrw03, gdxmr04, and gdxmrw05
from testlib. One or more of these will have working code to write a
set via wgdx().

-Steve

2012/4/13 Fabián Mancilla :

Hi,

I have a problem with the function wgdx(). I want save three
sets: jcon(j); jint(j); jbin(j), so I created three struct arrays:

s1.name = ‘jcon’; s1.uels = r1’;
s2.name = ‘jint’; s2.uels = r2’;
s3.name = ‘jbin’; s3.uels = r3’;

For example, the struct s1 is:

s1

s1 =

name: 'jcon'
uels: {1x470 cell}

Then, I used the function wgdx()as follow:

wgdx(‘fileGDX’,s1,s2,s3)

But, error comes saying: “Error using ==> wgdx Input structure field .val
must be double matrix”

In the manual of the GDXMRW tool (page 9) appear the following writing set
example:

s.name = ‘l’;
s.uels = {{‘i1’, ‘i2’, ‘i3’}, {‘j1’, ‘j2’}};
c.name = ‘par’;
c.type = ‘parameter’;
c.val = eye(3);
c.form = ‘full’;
c.ts = ‘3 x 3 identity’;
wgdx(‘foo’, s, c)

And the struct s don’t have .val field. Somebody know the reason of the
error?

Thanks in advance.


GDXfile.gdx (18.3 KB)

Fabian,

You haven’t sent anything that runs, or a complete example, as requested.

-Steve

2012/4/13 Fabián Mancilla :

Steve, thanks for the help!

The issue is in define s1.uels = r1’. If I define s1.uels = {r1’} the error
vanish. Then .uels field is ‘struct of struc’:

s1

s1 =

name: 'jcon'
uels: {{1x470 cell}}

I don’t know why wgdx() work properly with this definition. Curiously, for
exporting a parameter I defined the .uels field just like the first way and
I didn’t have any error. For example:

c3.name = ‘b’;
c3.type = ‘parameter’;
c3.val = b;
c3.uels = r1;
c3.form = ‘full’;
c3.ts = ‘Vector b’;

I attached the GDX file obtained, so you can review.

Regards

On Fri, Apr 13, 2012 at 11:15 AM, Steven Dirkse wrote:

Fabian,

You don’t include the full source for your example. If you could cut
it down from 470 elements and include the source for r1 one could give
you better advice about your example.

Also, you could look at the models gdxmrw03, gdxmr04, and gdxmrw05
from testlib. One or more of these will have working code to write a
set via wgdx().

-Steve

2012/4/13 Fabián Mancilla :

Hi,

I have a problem with the function wgdx(). I want save three
sets: jcon(j); jint(j); jbin(j), so I created three struct arrays:

s1.name = ‘jcon’; s1.uels = r1’;
s2.name = ‘jint’; s2.uels = r2’;
s3.name = ‘jbin’; s3.uels = r3’;

For example, the struct s1 is:

s1

s1 =

name: 'jcon'
uels: {1x470 cell}

Then, I used the function wgdx()as follow:

wgdx(‘fileGDX’,s1,s2,s3)

But, error comes saying: “Error using ==> wgdx Input structure field
.val
must be double matrix”

In the manual of the GDXMRW tool (page 9) appear the following writing
set
example:

s.name = ‘l’;
s.uels = {{‘i1’, ‘i2’, ‘i3’}, {‘j1’, ‘j2’}};
c.name = ‘par’;
c.type = ‘parameter’;
c.val = eye(3);
c.form = ‘full’;
c.ts = ‘3 x 3 identity’;
wgdx(‘foo’, s, c)

And the struct s don’t have .val field. Somebody know the reason of the
error?

Thanks in advance.


You received this message because you are subscribed to the Google
Groups
“gamsworld” group.
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.


Steven Dirkse, Ph.D.
GAMS Development Corp., Washington DC
Voice: (202)342-0180 Fax: (202)342-0181
sdirkse@gams.com
http://www.gams.com


“gamsworld” group.
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.


“gamsworld” group.
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.



– Steven Dirkse, Ph.D. GAMS Development Corp., Washington DC Voice: (202)342-0180 Fax: (202)342-0181 sdirkse@gams.com http://www.gams.com