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

Home » Public Forums » archive » Re: passing strings as arguments?
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: passing strings as arguments? [message #25365 is a reply to message #25225] Mon, 04 June 2001 23:39 Go to previous message
R.Bauer is currently offline  R.Bauer
Messages: 1424
Registered: November 1998
Senior Member
ronn kling wrote:
>
> in article yx6h3d9gufti.fsf@socrates.Berkeley.EDU,
> noymer@socrates.Berkeley.EDU at noymer@socrates.Berkeley.EDU wrote on 6/4/01
> 4:54 PM:
>
>> I am using Ronn Kling's PLOTSYM, the usage of which is:
>>
>> plot,x,y,psym=plotsym(/circle,scale=2,/fill)
>>
>> instead of /circle, one could use /box, /triangle, etc...
>>
>> I have something like:
>>
>> IF (condition) THEN myshape=string('/circle') ELSE
>> myshape=string('/triangle')
>> ENDIF
>>
>> and I want to pass the string "myshape" to plotsym as the
>> first argument but I can't figure out how to do this in IDL 5.3.
>>
>> It seems not to like strings being passed there.
> Hi Andrew,
>
> Plotsym is looking for keywords so passing a string isn't going to work. But
> you can use the _extra keyword instead. What you want to do is create an
> anonymous structure that contains the keywords. Here's how
>
> IF (condition) THEN myshape={circle:1} ELSE
> myshape={triangle:1}
> ENDIF
>
> plot,x,y,psym=plotsym(_extra=myshape,scale=2,/fill)
>
> You can also put the scale and fill keywords in myshape also. Just remember
> that something like /fill has to be fill : 1 in the structure.
>
> Ronn Kling

Dear Ronn,

If he is using create_struct to create the anonymous structure
he is able to use his string argument.


IF (condition) THEN myshape=create_struct(string_argument,1) ELSE $
myshape={triangle:1}

plot,x,y,psym=plotsym(_extra=myshape,scale=2,/fill)


cheers
Reimar


--
Reimar Bauer

Institut fuer Stratosphaerische Chemie (ICG-1)
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
http://www.fz-juelich.de/icg/icg1/
=============================================
a IDL library at ForschungsZentrum J�lich
http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_lib_intro.h tml

http://www.fz-juelich.de/zb/text/publikation/juel3786.html
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: trouble compiling AIM routines (mac files on windows?)
Next Topic: Re: thick = 2 and postscript output

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

Current Time: Fri Oct 10 01:33:15 PDT 2025

Total time taken to generate the page: 0.40058 seconds