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

Home » Public Forums » archive » simple FORMAT question for the experts
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
simple FORMAT question for the experts [message #61230] Thu, 10 July 2008 13:10 Go to next message
Ryan. is currently offline  Ryan.
Messages: 77
Registered: March 2006
Member
Hi,

I know this is a simple question for some, but for me who has not yet
become a master in formatting syntax I can't seem to get it right. I
am outputting a large number of files and on one line of those files,
I output a list of string values. The challenging part is that for
each file the list changes so the number of elements with a comma
separating each one and I would like to have one consistent format
string (if possible). I know I can combine strings with the number of
elements of the array but prefer not to go that route.

Here is a sample:
array = ['a','b','c','d','e']
print, 1S, 'Text', array, FORMAT='(I02, " ", A0, " :", A0, :, ",")'

I want this as a result:
01 Text :a,b,c,d,e

But I get this:
03 Text :a,
00 b :c,
00 d :e

Can anyone suggest where I'm going wrong?

Thanks,
Ryan.
Re: simple FORMAT question for the experts [message #61284 is a reply to message #61230] Sat, 12 July 2008 12:45 Go to previous messageGo to next message
Sven Geier is currently offline  Sven Geier
Messages: 17
Registered: July 2002
Junior Member
Ryan. wrote:

> Here is a sample:
> array = ['a','b','c','d','e']
> print, 1S, 'Text', array, FORMAT='(I02, " ", A0, " :", A0, :, ",")'
>
> I want this as a result:
> 01 Text :a,b,c,d,e
>
> But I get this:
> 03 Text :a,
> 00 b :c,
> 00 d :e

I may be misunderstanding what you're trying to do, but when I type this:

array = ['a','b','c','d','e']
print, 1S, 'Text', array, FORMAT='(I02, " ", A0, " :", 99(A0, :, ","))'

I get this:

01 Text :a,b,c,d,e




-- S

--
http://www.sgeier.net
My real email address does not contain any "Z"s.
Re: simple FORMAT question for the experts [message #61370 is a reply to message #61284] Mon, 14 July 2008 07:25 Go to previous message
Ryan. is currently offline  Ryan.
Messages: 77
Registered: March 2006
Member
> I may be misunderstanding what you're trying to do, but when I type this:
>
> array = ['a','b','c','d','e']
> print, 1S, 'Text', array, FORMAT='(I02, " ", A0, " :", 99(A0, :, ","))'
>
> I get this:
>
> 01 Text :a,b,c,d,e

Hi Steve,

That does give me what I need by putting an arbitrarily large number in
front of it but I have already modified it so it will print the exact
number of array elements. I like your solution because it is much
simpler than what I currently have.

Thanks,
Ryan.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: EARN MONEY $2500-10000 PER WEEK
Next Topic: Re: In need of array help!

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

Current Time: Wed Oct 08 19:58:04 PDT 2025

Total time taken to generate the page: 0.00566 seconds