How do I make a series of variables A1, A2, A3 within a loop?


I would like to generate a series of variables within a loop. Let's say I need to create five variables var_1, var_2, ..., var_5 as follows:

for i(1,5,1);

Of course I cannot use the running index i in "var_i" as it is, but there should be a way for doing this?

2 Answers


You could do the following to set symbol values using run-time string values:

for i(1,5,1);
    call varput(y[i], "var_"$+ntos(i));


The answer above using varput is correct. However, there is usually a better way to things in GAUSS. If you can tell a little about what you are trying to do, I may be able to help you come up with a better solution.

You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.

Try GAUSS for 14 days for FREE

See what GAUSS can do for your data

© Aptech Systems, Inc. All rights reserved.

Privacy Policy