Re: Problems to use variables in a keyword-expression [message #14314] |
Wed, 10 February 1999 00:00 |
rmlongfield
Messages: 68 Registered: August 1998
|
Member |
|
|
In article <79osii$m8j$1@ultra.csi.unimi.it>,
Ospite1 <"ospite1"@a5,itba.mi.cnr.it> wrote: (some words removed)
> The expression has to be something like this :
>
> anzfile = FINDFILE [ string(num*),format='(i12)' , count=anz ]
>
> Unfortunalely this is command doesn't work.
>
> Please help me !
>
> Ruth
>
Hi Ruth,
It looks like you have a simple typing mistake. The star in string(num*)
should not be there. I think that STRING is treating the
star as a character and not as a wildcard. Try
anzfile = FINDFILE(string(num)+'*',count=anz)
As an example, I have some program code which looks like this:
; Define prefixes and suffixes of desired data files
yydddhhmm = '962320734'
star = '*' ; wildcard
data_end = '.pif.Z'
filename_array=FINDFILE(yydddhhmm+star+data_end,COUNT=number _of_files);
Hope this helps.
Rose
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
|
|
|
Re: Problems to use variables in a keyword-expression [message #14320 is a reply to message #14314] |
Tue, 09 February 1999 00:00  |
J.D. Smith
Messages: 214 Registered: August 1996
|
Senior Member |
|
|
Ospite1 wrote:
>
> Hello,
>
> at the moment I have problems to find the right syntax for using
> variables in a
> keyword expression.
>
> My problem looks like this:
>
> the user should give an identifation number (num) for example
> 141098222.2 . With
> the FINDFILE command, which has integrated the count-keyword, I want to
> find the amount of all files in my directory ' paz' which begin with
> this number , they are named 141098222.21 , 141098222.22 etc.
>
> The expression has to be something like this :
>
> anzfile = FINDFILE [ string(num*),format='(i12)' , count=anz ]
>
> Unfortunalely this is command doesn't work.
>
> Please help me !
>
> Ruth
Try
anzfile=findfile(string(format='(I0,"*")',num),count=anz)
but only if num is an integer. If you really want num to be decimal,
your user must pass it in as a string, unless you just happen to know
you *always* want only one digit past the decimal, in which case you can
use a floating format. This is more error prone and dangerous, however.
Good Luck,
JD
--
J.D. Smith |*| WORK: (607) 255-5842
Cornell University Dept. of Astronomy |*| (607) 255-6263
304 Space Sciences Bldg. |*| FAX: (607) 255-5875
Ithaca, NY 14853 |*|
|
|
|