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

Home » Public Forums » archive » Re: Group specification of format codes on data of varying dimensions
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: Group specification of format codes on data of varying dimensions [message #60707] Mon, 09 June 2008 07:33
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
cgoethel@igpp.ucla.edu wrote:
> Hi All,
>
> I am having trouble figuring out how to use group specification of
> formats when my data has varying dimensions. For example:
>
> for i = 0l, c-1 do begin
> printf, lun, time_string, data[i,*], format='(12a,
> ncol(2x,e10.15))'
> endfor
>
> I would like to repeat the format (2x,e10.15) for the number of
> columns in data[i,*]. However, the number of columns varies. When I
> use a variable in the format statement, I get the error 'Expected
> comma or slash'.
> Any suggestions on how to handle this?

Build your format string using string operations:

format = '(12a, ' + strtrim(ncol, 2) + '(2x,e10.15))'
printf, lun, time_string, data[i,*], format=format

If you can construct it outside the loop, even better.

Mike
--
www.michaelgalloy.com
Tech-X Corporation
Software Developer II
[Message index]
 
Read Message
Previous Topic: Group specification of format codes on data of varying dimensions
Next Topic: Re: fast convolving question

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

Current Time: Fri Oct 10 14:14:59 PDT 2025

Total time taken to generate the page: 1.19980 seconds