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

Home » Public Forums » archive » Re: using an unlnown number of keywords
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: using an unlnown number of keywords [message #27388 is a reply to message #27381] Mon, 22 October 2001 11:47 Go to previous messageGo to previous message
Liam E. Gumley is currently offline  Liam E. Gumley
Messages: 378
Registered: January 2000
Senior Member
Sean Raffuse wrote:
>
> David Fanning <david@dfanning.com> wrote in message
> news:MPG.163a5b3f51d8f2ea989719@news.frii.com...
>> Sean Raffuse (sean@me.wustl.edu) writes:
>>
>>> I'm trying to write a more or less universal procedure that takes a data
>>> structure and prints the variables out one by one one a line in an ascii
>>> file. The problem is that the structure could have any number of
> variables.
>>> I want to do this:
>>>
>>> printf, lun, structure.var1, structure.var2, structure.var3, . . .,
>>> structure.varN
>>>
>>> If I know N, is there a way to do this without resorting to N cases?
>>
>> How about something like this:
>>
>> numTags = N_Tags(structure)
>> PrintF, lun, structure, Format='(' + StrTrim(numTags,2) + 'F10.2)'
>>
> This would work fine if I didn't have different data types. Strings (of
> various lengths) may be mixed with floats and integers. Any other ideas out
> there in IDL expert land??

Why not use default formatting? For example:

IDL> a = {var1:indgen(30), var2:['a', 'b', 'c'], var3:findgen(9)}
IDL> print, a
{ 0 1 2 3 4 5 6 7
8 9 10 11 12 13 14 15
16 17 18 19 20 21 22 23
24 25 26 27 28 29
a b c
0.00000 1.00000 2.00000 3.00000 4.00000
5.00000 6.00000 7.00000 8.00000
}

Each variable starts on a new line in the printed output.

Cheers,
Liam.
Practical IDL Programming
http://www.gumley.com/
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: profiler
Next Topic: Re: Really really long format keywords

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

Current Time: Thu Oct 09 22:09:19 PDT 2025

Total time taken to generate the page: 0.71970 seconds