FILEREAD Function
The FILEREAD function reads data from an arbitrary ASCII file.
Read a numerical value using the following general
syntax:
fileread("Filename", Line, Column)
The FILEREAD command contains the file name, the line number to read from and the column to read. The data in the respective columns of any line are separated by one or more spaces or tab characters.
For example, consider a data file containing a list of frequencies and a load impedance
for each
frequency:
Frequency in MHz Re(load) in Ohm Im(load in Ohm)
100 22.54 -12.56
150 25.07 -6.54
200 27.42 0.23
The frequency and loading can be imported directly from this file using the following
example
code:
#numfreq = 3 ** Number of frequencies
!!for #i = 1 to #numfreq
** Define the frequency (conversion from MHz to Hz)
#freq = 1.0e6*fileread("datafile.dat", #i+1, 1)
FR 1 0 #freq
** Define the load
#Zr = fileread("datafile.dat", #i+1, 2)
#Zi = fileread("datafile.dat", #i+1, 3)
LZ 0 #Zr #Zi
** Computations ...
!!next ** End of frequency loop