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

Home » Public Forums » archive » Re: Declaring large vectors 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
Re: Declaring large vectors in IDL [message #70549 is a reply to message #70480] Mon, 19 April 2010 16:57 Go to previous messageGo to previous message
fgg is currently offline  fgg
Messages: 67
Registered: April 2010
Member
And here's the adapted script in case it helps:

filters = ['*.txt', '*.dat', '*.out']
infile = dialog_pickfile(/read, filter=filters)
n = file_lines(infile)
raw_data = strarr(n)
openr, unit, infile, /get_lun
readf, unit, raw_data
close, unit & free_lun, unit
datas = where(stregex(raw_data,'=',/
boolean),ndata,complement=extra_lines)
data = raw_data[datas]
if (ndata lt n_elements(raw_data)) then begin
extra_assoc = value_locate(datas,extra_lines)
for i=0L,n_elements(extra_lines)-1 do $
data[extra_assoc[i]] = strjoin([temporary(data[extra_assoc[i]]),$
raw_data[extra_lines[i]]],/single)
endif
outfile = dialog_pickfile(/write, default_extension='pro',
filter='*.pro')
openw, outunit, outfile, /get_lun
for i=0,ndata-1 do begin
line = strsplit(data[i],/extract)
if (line[0] eq 'i_shot_ctr') then shot = line[2:*]
if (line[0] eq 'i_rng_wf' and n_elements(line) eq 4002) then $
for j=0,n_elements(shot)-1 do printf, outunit,
line[0]+'_'+shot[j]+' = ['+strjoin(line[j*200+2:j*200+201],', ')+']'
; This will not work. Max n_elements should be 251.
if (line[0] eq 'i_rng_wf' and n_elements(line) eq 10882) then $
for j=0,n_elements(shot)-1 do printf, outunit,
line[0]+'_'+shot[j]+' = ['+strjoin(line[j*544+2:j*544+545],', ')+']'
if (line[0] ne 'i_rng_wf') then printf, outunit,
strjoin(line[0:1],' ')+' ['+ strjoin(line[2:*],', ')+']'
endfor
print, 'End of processing.'
print, 'Type the following at the IDL prompt to display the
variables:'
print, "@'"+outfile+"'"
close, outunit & free_lun, outunit
end
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Comparison operators and floating-point errors
Next Topic: Re: Virtual machine popup

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

Current Time: Wed Oct 08 17:12:44 PDT 2025

Total time taken to generate the page: 0.00374 seconds