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

Home » Public Forums » archive » Re: print and printf
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: print and printf [message #57684] Wed, 19 December 2007 08:07
David Fanning is currently offline  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 Go to previous message
sujian is currently offline  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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: print and printf
Next Topic: Well, this is interesting...Not!

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

Current Time: Wed Oct 08 18:40:20 PDT 2025

Total time taken to generate the page: 0.00520 seconds