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

Home » Public Forums » archive » Create a structure in IDL
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Create a structure in IDL [message #94248] Mon, 06 March 2017 11:53 Go to previous message
francisco.pozon is currently offline  francisco.pozon
Messages: 2
Registered: March 2017
Junior Member
Hello everyone:

I would like to create a structure in IDL and put the information from my ASCII file. The problem is that I have several ASCII files and always the number of columns and rows are different. For example, I have the ASCII file "data.dat" and has 50 lines and 2040 columns. I know that we can define the data structure (if we assume I have only 5 columns):

datastruct = { col1:0L, col2:0.0, col3:0.0, col4:0.0, col5:0.0}

I can read my file and then replicate the structure:

file = 'data.dat'
nrows = file_line(file) ; to estimate the number of rows
data = replicate(datastruct, nrows)
openr, lun, file, /GET_LUN
readF, lun, data
free_lun, lun

I can do: print, data.col1 or print, data.col2 and so on... but this will give me only the first 5 columns. How I can do the same but for 2040 columns and also when we don't know in advance the number of columns in the file. Thanks for your help!
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: P-value, DF, Variance
Next Topic: Undefined procedure/function: 'REVERSE'

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

Current Time: Wed Oct 08 13:07:47 PDT 2025

Total time taken to generate the page: 0.00347 seconds