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


next up previous contents
Next: Display of Data Up: Examples Previous: Example 4: Editing Tables From AIPS

Example 5: Creating a Table from scratch

In this example, a table with two columns is created and then populated with some data. The first column is floating point data, the second column ascii.

tableName := 'junk.tbl'                                    # Name of table
nameCol1 := 'Velocity'                                     # Names of columns
nameCol2 := 'Colour'
c1 := tablecreatescalarcoldesc(nameCol1, 1.0)              # Column descriptors with template data type
c2 := tablecreatescalarcoldesc(nameCol2, 'A')
#
#
td := tablecreatedesc (c1, c2)                             # Combine column descriptors into table descriptor
#
#
nrow := 5
t := table (tableName, td, nrow)                           # Create table with given number of rows
#
#                                                       
col1Data := [pi, pi/2, pi*3, 0.0, -10.0]                   # Make some data of the right type and length
col2Data := "red green brown blue pink"                    
#
#
t.putcol(nameCol1, col1Data)                               # Insert columns 
t.putcol(nameCol2, col2Data)
#
t.browse()                                                 # Browse
#
t.done();                                                  # Destroy tool leaving disk file

next up previous contents
Next: Display of Data Up: Examples Previous: Example 4: Editing Tables From AIPS   Contents
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
2004-08-28