I don't have an answer for you, but I'm sure that what you want should be possible. Try to ask in a matlab related forum, like this:
MATLAB Central - Home
I use Matlab 6 which is used with some worksheets.
Currently the spreadsheet uses a macro that calls some files ".m" as the command:
Shell ( "C: \ matlab \ bin \ win32 \ MATLAB.EXE / r CALCULATE")
The problem is if it running in this manner, it doesn't gives an error when processing.
If there are any errors the program, it is running indefinitely.
Not so if we open the Matlab and execute manually.
In this case, the program says that the line is wrong and stop execution.
Is there a setting that makes Matlab always acknowledge the mistakes and stop the execution?