10.06.2016 Views

eldo_user

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Eldo Control Language<br />

Statement Overview<br />

A vector element can be addressed using the usual notation a[i], where a is the vector name and<br />

i is the index. i must have an integer value, otherwise it is rounded to a signed 32-bit integer<br />

number. Any attempt to address a vector outside of its allocated index range is trapped and<br />

causes an error (in the case that the .option set_<strong>eldo</strong>_cl_array_auto_expand is set to 0).<br />

One-dimensional Vectors<br />

Example:<br />

set a[] = 2001<br />

This command simply declares the vector a, and explicitly sets the initial value of any of its<br />

elements to 2001. This initialization is mandatory. The actual range will be assigned<br />

dynamically with further references and/or assignations.<br />

set b[0,99]=0<br />

This command declares the vector b, and explicitly sets the initial value of any of its element<br />

to 0. In this example, reading the vector from index 0 to index 99 will return 0. Reading outside<br />

of this range will extend the vector to the necessary size to make the reference “legal”, fill all<br />

uninitialized cells with the default value, and return the initial value. For example:<br />

set b[0, 99] = 0.1234 a = 1<br />

a = b[150]<br />

The reference to b[150] causes the b[] vector to be automatically extended. All cells from index<br />

100 to 150 are filled with the value 0.1234, and the a variable is assigned the value of b[150]:<br />

0.1234.<br />

Assigning an element whose index is outside the current range of the vector automatically<br />

extends its range. For example:<br />

set a[0,99]=3.14<br />

a[500]=17<br />

In this example, the first statement creates a vector a[] of 100 elements, from a[0] to a[99]. All<br />

elements are initialized to 3.14. The second assignment extends the range of a[] from 99 to 500,<br />

and fills a[500] with the value 17. The elements a[100] to a[499] are filled with the initial value<br />

of the vector, which is 3.14.<br />

If a vector has no explicit initial range, as in:<br />

set a[]=0<br />

then a subsequent assignment of an element with index will create the element i. For<br />

example:<br />

826<br />

Eldo® User's Manual, 15.3

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!