...
Additionally, it is possible to assign a vector to an indexed position in another vector, for example: v[4] = |99,99,99|
. In this example, elements 4, 5 and 6 of v
will be replaced.
Missing
...
values in
...
vectors
Vectors can contain missing values. These can be assigned or tested for using the global variable vector_missing_value
. Operations between vectors will bypass missing values. For example, if we represent a missing value with an 'x', then the result of
...
missing values from the field are automatically translated into missing values in the vector. The same is true when obtaining a vector of values from a geopoints variable. Missing values in vectors are also translated correctly when inserted into fieldsets and geopoints.
Exporting vector data to an ASCII file
The following piece of code illustrates one way to write the contents of a vector variable to text file:
Code Block | ||
---|---|---|
| ||
# Metview Macro v = |1,2,5,6,7| f = file('result.txt') # open a handle to the output file for i = 1 to count(v) do write(f, v[i], ',') # write each element of the vector end for write(f, newline) # write a newline at the end f = 0 # close the file handle |