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

Home » Public Forums » archive » Re: Help extracting a single column from dat 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: Help extracting a single column from dat file [message #90899] Sat, 09 May 2015 11:04 Go to previous message
Nikola is currently offline  Nikola
Messages: 53
Registered: November 2009
Member
On Saturday, May 9, 2015 at 9:30:22 AM UTC+1, JRP wrote:
> Hello,
>
> I need help extracting a single column from a sort of organized .dat file...
>
> The .dat files are structured as follows:
>
> Best filter size for grid = 8x 8, sample size = 2 has radius 9
> Best filter size for grid = 8x 8, sample size = 2 has radius 14
> Best filter size for grid = 8x 8, sample size = 3 has radius 19
>
> Hopefully someone can help me?
>
> I created these .dat files by simply copy/pasting some printed lines out of the IDL console. I know now that there would've been a better way to output the required data, but due to the time it takes to run these code I would like to see if there is any method of extracting a single column (In particular I need to extract the very last number, the radius i.e 9, 14, 19...). If there is no way for me to do this I'll just have to run everything again.
>
> Thanks in advance.

something like this will do you do the job:

n = FILE_LINES(filename)
data = INTARR(n)
line = ''
OPENR, un, filename, /get_lun
FOR i = 0, n-1 DO BEGIN
READF, un, line
data[i] = FIX(STRMID(line, 85, 8))
ENDFOR
FREE_LUN, un

I can think of several more elegant ways to do it, but this one is self-explanatory enough that you can easily modify it for other columns.
[Message index]
 
Read Message
Read Message
Previous Topic: Map an image onto a sphere
Next Topic: Problem with EXIT and garbage collection

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

Current Time: Wed Oct 08 15:13:27 PDT 2025

Total time taken to generate the page: 0.00371 seconds