comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » READ array from a file
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: READ array from a file [message #93118 is a reply to message #93085] Thu, 28 April 2016 21:42 Go to previous messageGo to previous message
zacharyanorman is currently offline  zacharyanorman
Messages: 17
Registered: July 2015
Junior Member
If you only have spaces ONLY between the name and the two arrays, then you can read the text file as a string array with:

;pre-allocate string array
infile = 'C:\some\file.txt'
nlines = file_lines(infile)
strings = strarr(nlines)
openr, lun, infile, /get_lun
readf, lun, strings
free_lun, lun


Then you can split each line with:


splitline = strsplit(strings[0], /extract)
name = splitline[0]
arr1 = splotline[2]
arr2 = splitline[3]


I'll let you figure out the rest for how you get the string representation of the arrays into actual arrays.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: READ ARRAY and extract the values
Next Topic: NetCDF4 problem

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:57:14 PDT 2025

Total time taken to generate the page: 0.00436 seconds