From: Thomas Goodwin on
I have a control loop driven by a timer, in case it makes any difference, and at some point during the script running, the script crashes out with the error "CAT arguments dimensions are not consistent."

I know this error means that somewhere along the line I'm concatenating numbers or strings together, but lasterr only prints the string for the error (no information about where the problem occurred), and MException.last is never the same between runs.

So far, I've tried various flavors of "dbstop if error" and "dbstop if caught error", but I am having trouble figuring out what the magic words (identifier or whatever other information) I need to make the simulation -stop- when it has the CAT error so I can figure out what is causing the problem. I've tried "dbstop if all error" but so far I haven't 'continued' far enough through a few hundred stops, I guess, to see the CAT error (I use try/catch to handle other problems).

Is there any way to specifically stop only when CAT throws a fit?
From: Jan Simon on
Dear Thomas!

> I have a control loop driven by a timer, in case it makes any difference, and at some point during the script running, the script crashes out with the error "CAT arguments dimensions are not consistent."
>
> I know this error means that somewhere along the line I'm concatenating numbers or strings together, but lasterr only prints the string for the error (no information about where the problem occurred), and MException.last is never the same between runs.
>
> So far, I've tried various flavors of "dbstop if error" and "dbstop if caught error", but I am having trouble figuring out what the magic words (identifier or whatever other information) I need to make the simulation -stop- when it has the CAT error so I can figure out what is causing the problem. I've tried "dbstop if all error" but so far I haven't 'continued' far enough through a few hundred stops, I guess, to see the CAT error (I use try/catch to handle other problems).
>
> Is there any way to specifically stop only when CAT throws a fit?

Create a function called "CAT" in the same folder as the calling function:

function R = cat(varargin)
try
R = builtin('cat', varargin);
catch
keyboard
end
return;

Then the processing stops with the KEYBOARD command, when CAT fails.

Good luck, Jan