Modify set from Matlab

I tried the following example from the Matlab AMPL API documentation website
ampl.eval(‘set A;’);
s = ampl.getSet(‘A’).get();
s.setValues({4.2, ‘4.2’, ‘a’, ‘b’});
s.asSet

It gives the following error:
No method ‘setValues’ with matching signature found for class ‘com.ampl.SetInstance’.

Also what if the new defined set has different size?

Thanks for the help.

1 Like

Hi @Sarah_O,

Thank you for reporting this issue. The documentation is not consistent with the current implementation, and we are currently reviewing it. You can assign values to a set as follows:

ampl = AMPL;
ampl.eval('set A;');
s = ampl.getSet('A');
s.setValues({4.2; '4.2'; 'a'; 'b'});