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

Home » Public Forums » archive » temporary() problem
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: temporary() problem [message #86025 is a reply to message #86024] Tue, 24 September 2013 13:32 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
spluque@gmail.com writes:

> I'm not sure I understand why the variable 'a' below gets undefined after calling a procedure using temporary():
>
> IDL> a='a, b, c'
> IDL> help, a
> A STRING = 'a, b, c'
> IDL> .run "test.pro"
> % Compiled module: TEST.
> IDL> test, a
> IDL> help, a
> A UNDEFINED = <Undefined>
>
>
> The contents of test.pro:
>
> PRO TEST, str
> ostr=strsplit(temporary(str), ', ', /extract)
> END
>
>
> Why is temporary() messing with the top level environment?

Because variables are passed by reference in IDL, not by value (copied
into the procedure). In this case, you are working with the variable str
itself, not a copy of the variable.

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Reading part of a netcdf file?
Next Topic: A newbie question regarding 3D plotting

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

Current Time: Fri Oct 10 19:37:55 PDT 2025

Total time taken to generate the page: 0.71944 seconds