Again: How to use FORMAT like sprintf?? [message #32235] |
Wed, 25 September 2002 00:32 |
Brian Huether
Messages: 12 Registered: September 2002
|
Junior Member |
|
|
I posted this question and got some great ansers but everytime I tried the
examples that you all showed me, IDL gave me this error:
Unexpected text in format
I am using IDL 5.2. Could that be the problem? If so, can someone explain
how to do what I need using version 5.2? Here is my original message:
thanks,
brian
--------------------------------------------------
I am quite perplexed by the IDL FORMAT keyword. I am used to MATLAB where I
can quite simply use the sprintf command. For instance, in MATLAB, the
command
s = sprintf('IDL has been driving me crazy for the last %d days', 10)
would result in a string that contains
'IDL has been driving me crazy for the last 10 days'
What I really need to do is something like this:
s = sprintf('SIZE(%s, /%s)', arrayname, somekeyword)
So if arrayname is A and somekeyword is TYPE, then the resulting string
would be
'SIZE(A, /TYPE)'
It is a meaningless example but hopefully you see what I want to do (i.e. I
need to execute IDL commands in a loop, where each time through, the command
input parameters are varying and are specified by indexing arrays that
contain the parameters)
|
|
|