setarrayentry
setarrayentry |
Purpose
Set a given entry of a named array
Synopsis
procedure xreflect~setarrayentry( entityname:string, indices:list of xreflect~basicvalue, newval:xreflect~basicvalue )
Arguments
entityname
|
The name of the public entity to access
|
indices
|
A list containing one value for each index set of the given array
|
newval
|
The value to insert into the array
|
Return value
A basicvalue containing the array entry for the given index values
Example
The following:
public declarations myvar: dynamic array(set of integer,set of integer) of real, end-declarations myvar(1,100) := 5.0 myvar(1,101) := 5.1 myvar(2,101) := 5.2 setarrayentry( 'myvar', [basicvalue(1),basicvalue(101)], basicvalue(17.5) ) writeln('myvar(1,101)=',myvar(1,101))
produces this output:
myvar(1,101)=17.5
Further information
1. If the specified entity name cannot be found, the model will terminate with a runtime error.
2. If the specified entity is not an array of a supported type, the model will terminate with a runtime error.
3. If the specified entity does not contain values of the same type passed in
newval, the model will terminate with a runtime error.
4. If the supplied indices list does not contain one basicvalue of the correct type for each index set of the array, the model will terminate with a runtime error.
5. The array index set contents may be modified by this function
Related topics