Re: newbie's question for writing files [message #53509] |
Tue, 17 April 2007 15:22  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
geonline714@gmail.com writes:
> Oh, my. Thank you so much. David. It seems that it really need high IQ
> to learn IDL. :)
Well, I'm pretty sure you knew more about this subject
when the day started than I did. I just read the manual
and started fooling around. The main difference between
us is probably that I'm not afraid to do something dumb
at the IDL command line. :-)
Cheers,
David
P.S. Not that I would usually admit it, you understand.
When I report a result, I try hard to make it look like
I'm a genius. :-)
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: newbie's question for writing files [message #53510 is a reply to message #53509] |
Tue, 17 April 2007 12:43   |
geonline714
Messages: 7 Registered: April 2007
|
Junior Member |
|
|
Oh, my. Thank you so much. David. It seems that it really need high IQ
to learn IDL. :)
SIncerely,
Qi
>
> Just throw in an extra set of parentheses. :-)
>
> printf, 1, X, format='((I0,100(2X,:,F0)))'
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: newbie's question for writing files [message #53511 is a reply to message #53510] |
Tue, 17 April 2007 13:19   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
geonline714@gmail.com writes:
> I have a question that need your kind help:
>
> I have an arrary X with 101 columns and want to output the first
> column to integer format and the rest 100 columns to float format:
>
> OPENW,1,'test.txt'
> printf, 1, X, format='(I0,100(2X,:,F0))'
> close, 1
>
> However, because I used the group specification, format control
> reverts to the group repeat specification whose opening parenthesis
> matches the next-to-last closing parenthesis of the format string. So,
> the data are output to float format except the first line. Would you
> please give me some advices for fixing this problem? Thanks
>
> Maybe I cannot use group specification here.
Just throw in an extra set of parentheses. :-)
printf, 1, X, format='((I0,100(2X,:,F0)))'
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: newbie's question for writing files [message #53726 is a reply to message #53509] |
Mon, 23 April 2007 10:04  |
JD Smith
Messages: 850 Registered: December 1999
|
Senior Member |
|
|
On Tue, 17 Apr 2007 15:22:27 -0700, David Fanning wrote:
> geonline714@gmail.com writes:
>
>> Oh, my. Thank you so much. David. It seems that it really need high IQ
>> to learn IDL. :)
>
> Well, I'm pretty sure you knew more about this subject
> when the day started than I did. I just read the manual
> and started fooling around. The main difference between
> us is probably that I'm not afraid to do something dumb
> at the IDL command line. :-)
>
> Cheers,
>
> David
>
> P.S. Not that I would usually admit it, you understand.
> When I report a result, I try hard to make it look like
> I'm a genius. :-)
This was a new trick for me... I end up with various loops to do
things like this. Any chance of putting it together into a tutorial?
JD
|
|
|