help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: catch an load file error in octave


From: Carlo de Falco
Subject: Re: catch an load file error in octave
Date: Fri, 31 Jul 2009 20:01:42 +0200


On 31 Jul 2009, at 17:56, Torsten Lange wrote:

Hello,

I have many output files from model runs. Some files were created but contain no data. That's why f = load('file.txt') stops the whole loop of "read- files/evaluate content" and I always have to check whether the script still
runs or not.

Now I modified the .m-script and wrote a bash script around to pass the whole
reading list even load() occasionally fails.

Is there any possibility to catch a load()-reading error to proceed with the
script directly in octave?

Thank you, Torsten

if for example you have your load command whithin a for or while loop
you could do something like the following to just skip to the lext step in the
loop whenever the file does not exist or is empty

for ii=1:maxii
%% do stuff
try

        f = load ("file_that_maybe_does_not_exist")

catch

        warning(lasterr ())
        continue

end_try_catch
%% do stuff
endfor

HTH,
c.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]