Passing a tuple from Matlab to GAMS

Questions on using the GAMS APIs (Python, .NET, etc.)
Post Reply
vuk19
User
User
Posts: 1
Joined: 3 years ago

Passing a tuple from Matlab to GAMS

Post by vuk19 »

Hi everyone,

I would like to pass a tuple from Matlab to GAMS and i get the following error:
UEL index in sparse matrix exceeds number of UELs in its column

Below is my matlab code to pass the data:


Geninmonth=csvread('Data.csv');
g.name='g';
g.type='set';
g.form='sparse';
g.uels=num2cell(unique(Geninmonth(:,1)))';

i.name='i';
i.type='set';
i.form='sparse';
i.uels=num2cell(unique(Geninmonth(:,6)))';


ig.name='ig';
ig.val = [Geninmonth(:,6) Geninmonth(:,1)];
ig.type='set';
ig.form='sparse';
ig.uels{1} = i.uels;
ig.uels{2} = g.uels;


wgdx('MtoG.gdx',i,g,ig)
Can someone guide me please on what i am doing wrong?

Attached is my matlab script and the associated data file Data.csv

Thank you.

Vijay
Attachments
Data.csv
(1.62 KiB) Downloaded 290 times
User avatar
Renger
Posts: 639
Joined: 7 years ago

Re: Passing a tuple from Matlab to GAMS

Post by Renger »

Hi
Although I am not fluent in Matlab, I noticed that your values are a 26x2 matrix, but the dimension of your sets is different 26 and not 2.
I hope this helps
Cheers
Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist
Post Reply