Writing a 3-dimensional table that is dynamically updated using MATLAB.
Having a table indexed over three sets (n,i,s) this is the following code that I use to write the GDX file using MATLAB:
t.name = ‘SOR’;
t.type = ‘parameter’;
t.form = ‘sparse’;
t.dim = 3;
t.val = [1 1 1 n.a(1,1) 1 1 2 n.a(1,2) 1 1 3 n.a(1,3) 1 1 4 n.a(1,4)
1 2 1 n.b(1,1) 1 2 2 n.b(1,2) 1 2 3 n.b(1,3) 1 2 4 n.b(1,4)
2 1 1 n.c(1,1) 2 1 2 n.c(1,2) 2 1 3 n.c(1,3) 2 1 4 n.c(1,4)
2 2 1 n.d(1,1) 2 2 2 n.d(1,2) 2 2 3 n.d(1,3) 2 2 4 n.d(1,4)];
t.uels = {p.uels, y.uels, z.uels};
wgdx(‘MtoG4’,t);
Where the first index n runs from 1 to 2, index i runs from 1 to 2 and s runs from 1 to 4. n here is a struct that contains the values. When I run this script I get the error, .val and .dim do not match. Can anyone help correct it