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

Home » Public Forums » archive » skip the corrupted hdf file and continue the for lood for uncorrupted hdfs
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: skip the corrupted hdf file and continue the for lood for uncorrupted hdfs [message #87350 is a reply to message #87349] Mon, 27 January 2014 01:25 Go to previous messageGo to previous message
Yngvar Larsen is currently offline  Yngvar Larsen
Messages: 134
Registered: January 2010
Senior Member
On Monday, 27 January 2014 09:22:26 UTC+1, Brent Fallarcuna wrote:

> My question is, can I continue my for loop and proceed reading the other uncorrupted hdf files every time I got the said error?
>
> I've tried catch statement but I can't figure it out on how to use and implement it correctly.
>

The solution should involve CATCH. Something like this:

for i=0, nfiles-1 do begin
;; Establish error handler
catch, error
if error ne 0 then begin
print, filename[i]
print, !error_state.msg
;; continue with next item in loop if error was encountered
catch, /cancel
continue
endif

hdf_id = hdf_sd_start(filename[i])
catch, /cancel
;; Do other stuff with file here if no error was encountered.
;; ...
endfor

--
Yngvar
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Instances of structure array with varying no. of elements
Next Topic: How can I change from qwerty keyboard to azerty ?

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

Current Time: Wed Oct 08 19:24:23 PDT 2025

Total time taken to generate the page: 0.00472 seconds