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

Home » Public Forums » archive » Re: my god this should be easy!
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
Re: my god this should be easy! [message #12251] Fri, 24 July 1998 00:00
David Kastrup is currently offline  David Kastrup
Messages: 33
Registered: February 1998
Member
mvukovic@my-dejanews.com writes:

> In article <6p8btl$2ub$1@filet.nrlssc.navy.mil>,
> "T Bowers" <tbowers@nrlssc.navy.mil> wrote:
>> what the...
>> how in the world do i write my data to a text file so it's tab delimited?
>>
>> sizeInfo = size(myData)
>> fmt = "(" + strtrim(string(sizeInfo[1]),2) + "(F0, TR1))"
>> printf, myFile, myData, FORMAT = fmt
>>
> this will not help you at all, but I found this little trick somewhere
> recently. If you are going to use STRTRIM, no need for STRING.
> Sure simplifies code writing although some purists would claim that
> it confuses the meaning of the code (I am sometimes in that camp).

Why not just write something like

printf,myfile,mydata, $
format=string((size(mydata))[1],format="('(',I0,'(F0,1H ))')"
where ^^^^^^^ this
is a single tabulator character?

If you don't like 1H<tab>, you can write ""<tab>"" in the above place,
but this does not make the results more readable...

--
David Kastrup Phone: +49-234-700-5570
Email: dak@neuroinformatik.ruhr-uni-bochum.de Fax: +49-234-709-4209
Institut f�r Neuroinformatik, Universit�tsstr. 150, 44780 Bochum, Germany
Re: my god this should be easy! [message #12252 is a reply to message #12251] Fri, 24 July 1998 00:00 Go to previous message
mallors is currently offline  mallors
Messages: 76
Registered: November 1997
Member
In article <6p8btl$2ub$1@filet.nrlssc.navy.mil>,
"T Bowers" <tbowers@nrlssc.navy.mil> writes:
> what the...
> how in the world do i write my data to a text file so it's tab delimited?
>
> sizeInfo = size(myData)
> fmt = "(" + strtrim(string(sizeInfo[1]),2) + "(F0, TR1))"
> printf, myFile, myData, FORMAT = fmt
>

You can print a tab using its byte value:

PRINT, 'x', STRING (9B), 'x'

A newline can be printed with STRING (10B), and
just for fun, try PRINT, STRING (7B)

-bob




--
Robert S. Mallozzi
http://cspar.uah.edu/~mallozzir/
Re: my god this should be easy! [message #12255 is a reply to message #12251] Fri, 24 July 1998 00:00 Go to previous message
Kevin Ivory is currently offline  Kevin Ivory
Messages: 71
Registered: January 1997
Member
T Bowers wrote:
> what the...
> how in the world do i write my data to a text file so it's tab delimited?
>
> sizeInfo = size(myData)
> fmt = "(" + strtrim(string(sizeInfo[1]),2) + "(F0, TR1))"
> printf, myFile, myData, FORMAT = fmt
>
> certainly doesn't work, it puts a space there (ascii 32 decimal) NOT
> a tab (ascii 09).

Instead of the TR1, put ' ' in your format description, that is
[single quote] [tab] [single quote].
I just tried it in an interactive session and it works fine:

IDL> print, format="(4(f0,' '))", findgen(10)
0.000000 1.000000 2.000000 3.000000
4.000000 5.000000 6.000000 7.000000
8.000000 9.000000
IDL>

Hope this helps
Kevin
--
Kevin Ivory Tel: +49 5556 979 434
Max-Planck-Institut fuer Aeronomie Fax: +49 5556 979 240
Max-Planck-Str. 2 mailto:Kevin.Ivory@linmpi.mpg.de
D-37191 Katlenburg-Lindau, GERMANY http://www.gwdg.de/~kivory2/
Re: my god this should be easy! [message #12256 is a reply to message #12251] Fri, 24 July 1998 00:00 Go to previous message
mvukovic is currently offline  mvukovic
Messages: 63
Registered: July 1998
Member
In article <6p8btl$2ub$1@filet.nrlssc.navy.mil>,
"T Bowers" <tbowers@nrlssc.navy.mil> wrote:
> what the...
> how in the world do i write my data to a text file so it's tab delimited?
>
> sizeInfo = size(myData)
> fmt = "(" + strtrim(string(sizeInfo[1]),2) + "(F0, TR1))"
> printf, myFile, myData, FORMAT = fmt
>
this will not help you at all, but I found this little trick somewhere
recently. If you are going to use STRTRIM, no need for STRING.
Sure simplifies code writing although some purists would claim that
it confuses the meaning of the code (I am sometimes in that camp).

mirko

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: [Q] Reading from ASCII file?
Next Topic: Re: [Q] Reading from ASCII file?

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

Current Time: Wed Oct 08 14:56:09 PDT 2025

Total time taken to generate the page: 0.00416 seconds