Skip to main content
1-Visitor
March 19, 2015
Solved

Random range variable

  • March 19, 2015
  • 2 replies
  • 1973 views

How can I define a range variable when the variables are not necessarily in defined pattern? I have got round the issue in the attached using a lookup expression from a table but can I not define d as a comma separated list? d:= 12,16,20,24,30,36 ? to simplify the expression?

Best answer by ptc-5377589

OK, this is better, thanks for your help Andy

Capture.JPGr

2 replies

12-Amethyst
March 19, 2015

What do you want to do with the range variable once it is created?

the FOR command in the programming toolbar gives a structure:

for <variable> <for each value in> LIST

that will allow you to produce a program as :

Capture.PNG

regards

Andy

1-Visitor
March 19, 2015

Thanks Andy, I've been trying since you posted but I can't see how I actually use that in my programme? In the end I'm trying to avoid using a lookup table and using a for statement similar to yours! Alas my understanding is failing!
Capture.JPG

ptc-53775891-VisitorAuthorAnswer
1-Visitor
March 19, 2015

OK, this is better, thanks for your help Andy

Capture.JPGr

23-Emerald I
March 19, 2015

Rather than a lookup table, use a vector.

23-Emerald V
March 20, 2015

Fred Kohlhepp wrote:

Rather than a lookup table, use a vector.

Indeed. In this instance, getting the vector should be a straight forward matter of using submatrix to extract it from Table1.

d:=submatrix (Table1, 1, rows (Table1)-1,1,1)

Stuart