Creating a numberList from values in a script

I have some values pulled from an earlier screen and I would like them to form the basis of a numberList (so that I can perform a regression.)

If the values are a_1, a_2 and a_3 within my CL script I would like to do something like

numberList("x_1"): [a_1, a_2, a_3]

or

numberList("x_1"): makeList("[${a_1}, ${a_2}, ${a_3}]")

Is there a way I can accomplish this wtihin CL?

Is there any reason you can’t just pass the values of a_1, a_2, and a_3 to the calculator so that you can define the list x_1=[a_1, a_2, a_3] in a calculator cell? I assume that you’re going to be using a calculator component to perform the regression.

This seems naughty (cuz it uses rawExpression), but it will probably get the job done if you absolutely need to get it done using CL.

number("a_1"): 1
number("a_2"): 2
number("a_3"): 3

rawExpression: "x_1=[a_1, a_2, a_3]"

Agree with serge here. Creating the list in calc is probably best.

My initial plan was to pass them all to the calculator. The problem is that I want to perform a regression on the list it doesn’t seem to work when I pass the values through CL.

I can make it work in the regular calculator.

But when I try to pass those values in via CL I get the points plotted but an error message attached to the regression saying “We couldn’t find any region where this model is defined.”

I assumed it was because there were just too many variables flying around but maybe there is some other reason?

If you give me more context I can help you out more, but I threw together something from what you gave me. Not sure how well it applies:

Thanks for this Jay, and apologies to have wasted your time but I just then resolved the issue.

It was because one of the values that I was putting into the regression was undefined (they were coming from min(s16.sketch.yValuesAt(x_1)) and that was causing the regression to fail.

Thanks for your help!

1 Like