Re: print and printf [message #57684] |
Wed, 19 December 2007 08:07 |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
JHUsalon writes:
> my code:
> -----------------------------
> .run
> openw,lun,'zhut.txt',/get_lun,width=40
> myi.field8=myi.field1+myi.field4
> myi.field6=myi.field8(sort(myi.field8))
> printf,myi.field6(uniq(myi.field6))
> free_lun,lun
> end
> -----------------------------
> and it turns out to
>
> PRINTF: Expression must be a scalar or 1 element array in this
> context: <STRING Array[41952]>.
>
> but if i change printf to print, myi.field6(uniq(myi.field6)) will be
> displayed on the screen.
>
> what's the other difference btw print and printf?
I'd try this:
IDL> ? PRINTF
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: print and printf [message #57685 is a reply to message #57684] |
Wed, 19 December 2007 08:05  |
sujian
Messages: 10 Registered: May 2007
|
Junior Member |
|
|
On Dec 19, 11:00 am, JHUsalon <suj...@gmail.com> wrote:
> hi all,
>
> my code:
> -----------------------------
> .run
> openw,lun,'zhut.txt',/get_lun,width=40
> myi.field8=myi.field1+myi.field4
> myi.field6=myi.field8(sort(myi.field8))
> printf,myi.field6(uniq(myi.field6))
> free_lun,lun
> end
> -----------------------------
> and it turns out to
>
> PRINTF: Expression must be a scalar or 1 element array in this
> context: <STRING Array[41952]>.
>
> but if i change printf to print, myi.field6(uniq(myi.field6)) will be
> displayed on the screen.
>
> what's the other difference btw print and printf?
>
> thanks
> sukye
yes i am stupid...printf,LUN...should work
|
|
|