Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
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
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/
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/
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