Vanguard Software
Forecasting & Planning Solutions

contents.gifindex.gifprev1.gifnext1.gif

Subscript

Format: x # y

Arguments: [any] x Input list

[int] y Element number(s)

Returns: [any] The one-based yth element(s) in the list x

Description: This operator is used to extract one or more elements from a list. Note that the first element in the list is x#1, not x#0.  If y is less than 1 or greater than the length of list x, null is returned.

If y contains a list of element numbers, a list of corresponding elements is returned. For example, x#3..5 returns the third, fourth, and fifth elements in x.

If x is a matrix (list of lists), you can extract particular elements by using this operator twice. For example, x#3#6 returns the element in column 3, row 6. You can also extract entire columns or rows. For example, x#3 returns the entire third column. Similarly, x##6 returns the entire sixth row. To extract a range in a matrix, enter a range of values for the row and column numbers. x#3..4#4..6 returns all elements in columns 3 and 4 of rows 4, 5, and 6.

Note that x[y] and x#y are identical except that x[y] uses zero-based index numbers while x#y is one-based.

Examples: [11,12,13,14]#1 = 11

[11,12,13,14]#2..4 = [12,13,14]

["a","b","c"]#3 = c

[[1,2],[3,4]]#2 = [3,4]

[[1,2],[3,4]]#2#1 = 3

x#count(x) = last element in the list named x

See Also: List Element, sublist, last, List Literal

  Forecasting Software  |  Strategic Planning Software  |  Decision Support Software
Decision Tree Software  |  Monte Carlo Simulation Software  |  Risk Analysis Software
Portfolio Analysis Software  |  Expert System Software  |  Market Research Surveys

Contact Us  |  Terms of Use  |  Privacy Policy  |  Site Map
Vanguard Software
© 2009 Vanguard Software Corporation
Home Products Solutions Services Customers Partners Company
Vanguard
Applying science to business management
Vanguard
Print this page   Email this page to a friend