tia
Will
This code appears to catch an exception from Java. However, I'm not sure about catching a java.lang.OutOfMemoryError message. I'm a little fuzzy on whether one can catch children of java.lang.Error in Java, let alone Matlab.
From the JavaDoc for java.lang.Error:
An Error is a subclass of Throwable that indicates serious problems that a reasonable application should not try to catch.
% catch_java_error.m
% A quick test to show Matlab catching a Java error.
% Create a java.lang.String, then catch the error when we pass an invalid
% argument to its substring method
js = java.lang.String('a string')
js.substring(4)
try
js.substring(10)
catch ME
disp('Caught the Java exception');
disp(ME);
disp(ME.message);
end
Output:
js =
a string
ans =
ring
Caught the Java exception
MException object with properties:
identifier: 'MATLAB:Java:GenericException'
message: [1x195 char]
stack: [1x1 struct]
cause: {}
Java exception occurred:
java.lang.StringIndexOutOfBoundsException: String index out of range: -2
at java.lang.String.substring(Unknown Source)
at java.lang.String.substring(Unknown Source)
You won't be able to trap the error unless it's being generated from your
own Java code. However you can increase the amount of Java memory available
to MATLAB using the instructions here:
http://www.mathworks.com/support/solutions/data/1-4HCPJ8.html?product=SB&solution=1-4HCPJ8
"William Slater" <William....@LMCO.com> wrote in message
news:gd892j$mdf$1...@fred.mathworks.com...