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

Home » Public Forums » archive » Re: Data management... but Execution halts!!! T.T
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: Data management... but Execution halts!!! T.T [message #51388 is a reply to message #51292] Wed, 15 November 2006 10:22 Go to previous message
greg michael is currently offline  greg michael
Messages: 163
Registered: January 2006
Senior Member
Wrote a reply already... seems not to have turned up :(

Yes, actually that seems to work fine - it's especially useful that it
can handle mixed-type tables. I take back (some of) the bad things I
said about read_ascii! You can use this to generate the code for
copy/paste:

pro what_ascii_template
t=ascii_template()
tags=tag_names(t)
n=n_tags(t)
print,'template={$'
for i=0,n-1 do begin
if size(t.(i),/type) eq 7 then s="'"+t.(i)+"'" else
s=strtrim(t.(i),2)
s=strjoin(s,',')
if n_elements(t.(i)) gt 1 then s='['+s+']'
print,' ',tags[i],'=',s,(i lt n-1)?',$':'}'
endfor
end

IDL> what_ascii_template
template={$
VERSION=1.00000,$
DATASTART=0,$
DELIMITER=,$
MISSINGVALUE=NaN,$
COMMENTSYMBOL='#',$
FIELDCOUNT=7,$
FIELDTYPES=[4,3,4,4,3,4,4],$

FIELDNAMES=['FIELD1','FIELD2','FIELD3','FIELD4','FIELD5','FI ELD6','FIELD7'],$
FIELDLOCATIONS=[0,18,22,34,52,58,70],$
FIELDGROUPS=[0,1,2,3,4,5,6]}

Think I'm converted - thanks! Solves Rick's problem, too, since you can
modify or generate the field names yourself.

Greg

Maarten wrote:
> greg michael wrote:
>> The problem with read_ascii is the template. If your file has anything
>> other than a trivial format (as this one does) - i.e. a header of some
>> sort, or mixed types, you need to use a template. And you can't
>> (reasonably) generate this programmatically, but only via the
>> ascii_template GUI function. Try it, then you'll want to learn the
>> other way...
>
> Nah, use it once, use 'help, /structure, template' to figure out what
> the
> returned struct looks like, and then put that struct in your code.
> Works
> like a charm.
>
> There are some formats that require more coding, but read_ascii() with
> ascii_template() _once_ isn't too bad.
>
> Maarten
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: canonical correlations
Next Topic: Data management... but Execution halts!!! T.T

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

Current Time: Wed Oct 08 18:15:42 PDT 2025

Total time taken to generate the page: 0.00410 seconds