Tutorial > Reading Data into PV-WAVE > Lesson 1: Reading ASCII Data
  

Lesson 1: Reading ASCII Data
This example demonstrates how to read in elevation data from the ASCII data file, pikeselev.dat. This is a standard ASCII file containing the elevation data taken from the Pikes Peak region of Colorado. This file is located in <RW_DIR>\wave\data, where <RW_DIR> is your installation directory.
To read this file, do the following:
1. Define a variable for the data, which contains a 60-by-40 floating-point array. Do the following to define the variable:
peak = FLTARR(60, 40)
2. Open the file for reading. The LUN assigned to the file is 1.
(WIN) OPENR, 1, GETENV("RW_DIR") + '\wave\data\pikespeakelev.dat'
(UNIX) OPENR, 1, '$RW_DIR/wave/data/pikeselev.dat'
 
3. Read from LUN 1 and store this in the variable, peak.
READF, 1, peak
4. Close the file, using the LUN associated with the file you want to close.
CLOSE, 1

Version 2017.1
Copyright © 2019, Rogue Wave Software, Inc. All Rights Reserved.