Jump to: navigation, search

Get the elements of a vector by their index as enumerated in another vector or matrix


return = Element(Values; Index);

Return value

Element returns a vector of the size of Index with element values coming from Values. If Index contains a value that is not a proper index of Values, then an error is raised. If Index contains a value that is not an integer value, then that index value is cut of to an integer value.


Values vector
Index vector or matrix with index positions in Values


a = 11#15
11	12	13	14	15

Element(a; 1, 3, 5)
11	13	15

Element(a; 1, 3, 5, 9)
C:\WINDOWS\system32\MPLMath.dll : Error R0x000401 : Index out of range in CMathObject::Element

Element(a; 1, 3, 5, Pi())
11	13	15	13