About Chandra Archive Proposer Instruments & Calibration Newsletters Data Analysis HelpDesk Calibration Database NASA Archives & Centers Chandra Science Links

Skip the navigation links
Last modified: December 2006

URL: http://cxc.harvard.edu/ciao3.4/assoc_get_values.tm.html
Hardcopy (PDF): A4 | Letter
AHELP for CIAO 3.4 assoc_get_values Context: slangrtl

Synopsis

Return all the values of an Associative Array

Syntax

Array_Type assoc_get_keys (Assoc_Type a)

Description

This function returns all the values in the associative array a as an array of proper type. If the associative array contains no keys, an empty array will be returned.

Example

Suppose that a is an associative array of type Integer_Type, i.e., it was created via

      variable a = Assoc_Type[Integer_Type];

The the following may be used to print the values of the array in ascending order:

      static define int_sort_fun (x, y)
      {
         return sign (x - y);
      }
      define sort_and_print_values (a)
      {
         variable i, v;

	 v = assoc_get_values (a);
	 i = array_sort (v, &int_sort_fun);
	 v = v[i];
	 foreach (v)
	   {
	      variable vi = ();
	      () = fprintf (stdout, "%d\n", vi);
	   }
      }
Hardcopy (PDF): A4 | Letter
Last modified: December 2006



The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory.
60 Garden Street, Cambridge, MA 02138 USA.    Email: cxcweb@head.cfa.harvard.edu
Smithsonian Institution, Copyright © 1998-2004. All rights reserved.