index of elements in GAMS
Posted: Fri Jun 18, 2021 2:18 am
Hi,
I have a set in MATLAB that I want to export it to GAMS and the order of elements in the set is important to me. As I know, the order that I define the set for the first time is the order that is defined for GAMS.
As an example, I have the below code in MATLAB:
Is.name='i';
Is.type='set';
Is.val=[3;2;1];
Is.dim=1;
wgdx('data',Is)
And the following code is in GAMS:
$GDXIN 'data'
Sets
i ;
$load i
$GDXIN
display i;
but the output for i is 1,2,3. but I want the order be 3,2,1.
the gdx file is attached.
I have a set in MATLAB that I want to export it to GAMS and the order of elements in the set is important to me. As I know, the order that I define the set for the first time is the order that is defined for GAMS.
As an example, I have the below code in MATLAB:
Is.name='i';
Is.type='set';
Is.val=[3;2;1];
Is.dim=1;
wgdx('data',Is)
And the following code is in GAMS:
$GDXIN 'data'
Sets
i ;
$load i
$GDXIN
display i;
but the output for i is 1,2,3. but I want the order be 3,2,1.
the gdx file is attached.