Dear all,

I am trying to export a set and a parameter from MATLAB to GAMS.

As an example, Consider the set is i = [2;5;1;6] and the parameter x(i) is [10 -6 3 -5] in MATLAB. my problem is that the parameter isn’t exported correctly to GAMS.

I try the below code in MATLAB:

Is.name=‘i’;

Is.type=‘set’;

Is.val=i;

Is.dim=1;

Xs.name=‘x’;

Xs.type=‘parameter’;

Xs.form=‘full’;

Xs.val=x;

Xs.dim=1;

wgdx(‘data’,Is,Xs);

and I try the below code in GAMS

Sets

i;

PARAMETER x(i);

$GDXIN C:\Users\Bahar\Dropbox\My Matlab Code\Solution Approach\data.gdx

$LOAD i,x

$GDXIN

display i,x;

and I get the below result in GAMS:

i: 1, 2, 5, 6

x(i): 1 10.000, 2 -6.000

As you see, the parameter isn’t exported correctly. also the order of set i is changed.

How should I do to export the data from MATLAB to GAMS correctly?

I appreciate it if someone can help me.

Thanks and regards,

Bahar