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

Home » Public Forums » archive » Re: Formatted printf output
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: Formatted printf output [message #76623] Tue, 21 June 2011 07:11 Go to next message
Wout De Nolf is currently offline  Wout De Nolf
Messages: 194
Registered: October 2008
Senior Member
On Tue, 21 Jun 2011 06:30:11 -0700 (PDT), Axel M <axelus@gmail.com>
wrote:

> Hi,
> I am trying to print a list of numerical values into a .txt file to be
> later imported by Excel. For this purpose, I want to change IDL's
> output when printing from 2.35 to 2,35 (comma).
> I was looking in the format codes in printf but was not successful...
> Somebody has a clue how to do that?

Other than converting to a string and parsing with STRSPLIT/STRJOIN or
STRPOS/STRPUT, I wouldn't know.
Re: Formatted printf output [message #76704 is a reply to message #76623] Wed, 22 June 2011 03:12 Go to previous message
Axel Martínez is currently offline  Axel Martínez
Messages: 22
Registered: June 2010
Junior Member
On Jun 21, 4:11 pm, Wox <s...@nomail.com> wrote:
> On Tue, 21 Jun 2011 06:30:11 -0700 (PDT), Axel M <axe...@gmail.com>
> wrote:
>
>> Hi,
>> I am trying to print a list of numerical values into a .txt file to be
>> later imported by Excel. For this purpose, I want to change IDL's
>> output when printing from 2.35 to 2,35 (comma).
>> I was looking in the format codes in printf but was not successful...
>> Somebody has a clue how to do that?
>
> Other than converting to a string and parsing with STRSPLIT/STRJOIN or
> STRPOS/STRPUT, I wouldn't know.

Ok, thanks.

It is not optimal in my situation, because STRPUT and STRPOS accept
string arrays, but STRPUT accepts only a scalar value for the
position, so that I would need to create a FOR loop iterating over
each single value...

Is there some other solution using string formatting which would avoid
this? I copy my simple code below.

;Save a 1D or 2D array as text file with : separated values which can
be imported by Excel
PRO XLS_save, fn, data
OPENW, unit, fn, /GET_LUN
FOR i=0, (SIZE(data, /DIMENSIONS))[0]-1 DO BEGIN
printf, unit, STRJOIN(STRING(REFORM(data[i,*])), ':')
ENDFOR
CLOSE, unit & FREE_LUN, unit
END
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Strange behaviour ? of Subscript range values of the form low:high
Next Topic: Column vector matrix creation from PC image

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

Current Time: Wed Oct 08 15:12:11 PDT 2025

Total time taken to generate the page: 0.00451 seconds