Hi,
You're right, the inconsistency in console output between direct Java calls and those routed through MATLAB can be frustrating. Here are some ways to capture the elusive error information in your scenario:
1. Leverage matlab.exception.JavaException:
- When calling Java methods from MATLAB using javaMethod, wrap the call in a "try-catch" block.
- Inside the "catch" block, catch the "matlab.exception.JavaException" class.
- This exception object contains the original Java stack trace and error message. You can access them using the "message" and "stack" properties of the exception object.
2. Capture Console Output:
- Use diary function to redirect the console output to a file.
diary('matlab_java_output.txt');
This captures all console output, including potential errors, for later inspection.
3. Debug Within MATLAB:
- Set breakpoints in the MATLAB code that might be called from Java. This allows you to pause execution and inspect variables when the error occurs.
By catching exceptions, enabling verbose mode, or capturing console output, you should be able to identify the source of the error causing the beep in your MATLAB environment.
Hope it helps.