Passing a tuple from Matlab to GAMS

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
Data.csv (1.62 KB)

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