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

Home » Public Forums » archive » Re: Printing in one line
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: Printing in one line [message #70452 is a reply to message #70449] Mon, 12 April 2010 17:27 Go to previous messageGo to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
On Apr 12, 8:08 pm, fgg <fabioguimaraesgoncal...@gmail.com> wrote:
> On Apr 12, 5:05 pm, fgg <fabioguimaraesgoncal...@gmail.com> wrote:
>
>
>
>> Hi,
>
>> Here's an easy one. I have an array[5], y:
>
>> IDL> print, y
>> data = 1 2 3
>
>> and I'd like to make IDL print:
>
>> data = [1, 2, 3]
>
>> When I try:
>> IDL> m = n_elements(y)
>> IDL> print, y[0:1], '[', y[2:m-2]+',', y[m-1] + ']'
>
>> IDL prints:
>> fabio =
>> [
>> 1, 2,
>> 3]
>
>> How can I get this result in just one line (instead of 4)?
>
>> Thanks in advance,
>> Fabio
>
> Sorry... actually IDL prints:
> data =
> [
> 1, 2,
> 3]

What you want is a FORMAT keyword. This does the trick for a three-
element array...

IDL> print, y, format='("[",3(I0,:,","),$)' & print, ']'
[1,2,3]
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: IMAGE_STATISTICS for 3D Array
Next Topic: IDL license costs in europe?

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

Current Time: Fri Oct 10 15:20:26 PDT 2025

Total time taken to generate the page: 1.02229 seconds