WGDX help for newbie

Problems with modeling
Post Reply
yashas1354
User
User
Posts: 1
Joined: 1 week ago

WGDX help for newbie

Post by yashas1354 » 1 week ago

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
Last edited by yashas1354 on Mon Sep 17, 2018 7:09 pm, edited 1 time in total.

User avatar
Renger
Posts: 161
Joined: 2 years ago

Re: WGDX help for newbie

Post by Renger » 1 week ago

Hi
Could you please post a running example of the matlab code, i.e. how you generate the variable n? Don't expect people to infer parts of your code .
CHeers
Renger

Post Reply