Q_m = struct('name', 'Q_m', 'type', 'parameter', 'form', 'full', 'val', 4); Q_p = struct('name', 'Q_p', 'type', 'parameter', 'form', 'full', 'val', 1); R_m = struct('name', 'R_m', 'type', 'parameter', 'form', 'full', 'val', 4); R_p = struct('name', 'R_p', 'type', 'parameter', 'form', 'full', 'val', 1); t = struct('name', 't', 'type', 'set', 'form', 'full', 'val', 1, 'uels', {{'s1'}}); wgdx('gams_matlab.gdx', Q_m, Q_p, R_m, R_p, t); cost = gams('myopic_gams_matlab.gms LP=cplex', t, Q_m, Q_p, R_m, R_p); reward = cost.val;