Exporting data from MATLAB to GAMS

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

답변 (0개)

카테고리

도움말 센터File Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

태그

질문:

2021년 4월 25일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by