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

Home » Public Forums » archive » End of Array - like - End Of File
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: End of Array - like - End Of File [message #26281 is a reply to message #25952] Mon, 20 August 2001 07:36 Go to previous messageGo to previous message
Liam E. Gumley is currently offline  Liam E. Gumley
Messages: 378
Registered: January 2000
Senior Member
Timm Weitkamp wrote:
>
> Reimar's suggestion of using the COUNT keyword to FINDFILE is indeed
> *much* better than using N_ELEMENTS, because the latter will result in
> an error when the file list is empty (unless you use an additional
> line to catch that situation). The reason is that when FINDFILE finds
> no matches, its return value is a scalar null string, and N_ELEMENTS()
> of that is one (not zero).
>
> Reimar Bauer <r.bauer@fz-juelich.de> wrote in message news:<3B7FF5BE.526BE6@fz-juelich.de>...
>> "Emmler, Oliver" wrote:
>>>
>>> Hi all,
>>> i have a directory with different numbers of files. I read the filenames by
>>>
>>> text = FINDFILE('H:/radiologie/*.dcm')
>>
>> you should use the count keyword of findfile
>>
>> Result = FINDFILE( File_Specification [, COUNT=variable] )
>>
>> FOR i=0,count-1 do ...
>>
>> regards
>> Reimar

I actually prefer the following syntax:

list = findfile('*.dcm')
if (list[0] ne '') then begin
;- process each name in list
endif

This takes advantage of the fact that FINDFILE returns a null string if
no files are found.

Cheers,
Liam.
Practical IDL Programming
http://www.gumley.com/
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Video for Windows, Clear text in Object Graphics and a genetic algorithm
Next Topic: Re: Puzzle with floating point underflow

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

Current Time: Sat Oct 11 16:39:01 PDT 2025

Total time taken to generate the page: 3.11992 seconds