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 #25225] Mon, 04 June 2001 14:17 Go to previous message
ronn is currently offline  ronn
Messages: 123
Registered: April 1999
Senior Member
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


--
Ronn Kling
KRS, inc.
email: ronn@rlkling.com
"Application Development with IDL"� programming book updated for IDL5.4!
"Calling C from IDL, Using DLM's to extend your IDL code" NEW BOOK!
Shareware and Freeware at: http://www.rlkling.com/
[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: Wed Oct 08 18:43:29 PDT 2025

Total time taken to generate the page: 0.22285 seconds