help-octave
[Top][All Lists]
Advanced

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

Optional argument to the catch statement


From: Peter L. Soendergaard
Subject: Optional argument to the catch statement
Date: Fri, 05 Apr 2013 15:24:10 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2

Are there any plans for supporting the following syntax (works in Matlab)

try
    load 'Thisfiledoesnotexist';
catch err
    disp(err.message)
end;

The issue here is the argument "err" to the catch statement, which does not seems to be supported in Octave currently (neither stable nor development). You can work around the problem using this construction:

try
    load 'Thisfiledoesnotexist';
catch
    disp(lasterr.message)
end;

but Matlab are discouraging the use of the lasterror function because it depends on a global variable, so people choose the other syntax instead.

Cheers,
Peter.



reply via email to

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