Getting Started Documentation Glish Learn More Programming Contact Us
Version 1.9 Build 1488
News FAQ
Search Home


next up previous contents index
Next: r_fill - Function Up: quanta - Module Previous: r_array - Function


r_slice - Function



Package general
Module quanta


Get a slice of a record array


Synopsis
r_slice(v, ...)


Arguments

v in a record array from which to extract elements
    Allowed: record (array)
... in slicing dimensions
    Allowed: integers, an index record, integer vectors


Returns
record array


Description
r_slice creates an array of records as a slice from another array of records. Slice indexing is identical to all the normal Glish options (including using a record index). The result will be another array of records (a scalar if 1 element is selected) with the id preserved.



Example
- print a := r_array(1:5, 2, 3)			# create array
[*31=1, *32=2, *33=3, *34=4, *35=5, *36=1]
- a::						# its shape
[shape=[2 3] ] 
-  r_slice(a,5)					# one element index
5 
- r_slice(a,5)::				# gives a scalar
[=] 
- r_slice(a,1,)					# a slice
[*39=1, *40=3, *41=5] 
- r_slice(a,1,)::				# gives a vector
[shape=3] 
- r_slice(a,1,2:3)				# and another
[*49=3, *50=5] 
- r_slice(a,1,2:3)::
[shape=2] 
[*17=1, *18=2] 
- r_slice(a,1:2,)::				# an array slice
[shape=[2 3] ]





next up previous contents index
Next: r_fill - Function Up: quanta - Module Previous: r_array - Function   Contents   Index
Please send questions or comments about AIPS++ to aips2-request@nrao.edu.
Copyright © 1995-2000 Associated Universities Inc., Washington, D.C.

Return to AIPS++ Home Page
2006-08-01