Very helpful and thorough! I only have a couple of minor quibbles - 1) the author didn't make it totally clear what normal MATLAB line properties you should use to change the arrow color and arrowhead color. But it's not too hard to figure out. 2) The author didn't assign message identifiers to the warnings (like for changing the axis limits). I edited the function to add message identifiers so I could turn them off - don't need my Command Window cluttered up with a lot of orange text.
I've been thinking about incorporating this for a while, hemming and hawing. Tried it today, finally, and I'm sold. Great job.
I wish there were a way to match the display to the Command Window format setting - I generally like to display more significant digits than short g allows. But it appears that there's no easy way to retrieve the current command window display format (I'll bet Yair Altman could figure one out, but I couldn't). I know you can use the .value method to display it in the desired format, but that's sort of inelegant.
The workaround for me was to edit unit\display directly, changing the sprintf format from %g to %0.12g (I chose 12 rather arbitrarily).
This is a superb tool, and it's helping me write better code already. I have a question.
I'm writing a value class that doesn't use the handle graphics set/get functions, and I want to use the xUnit test framework to verify that the proper errors pop up if I set properties to incorrect values, like:
myObj.my3Vector = [1 1];
In the set.my3Vector method I've defined an error message:
error('myClass:3Vec','Needs 3 elements')
The assert* functions work perfectly in diagnosing problems when I set the values as properties in the class constructor, because the class constructor expression doesn't need an '=' sign. The problem is that in diagnosing the first expression, I can't use an anonymous function handle because of the '=' sign. I guess if I were writing a handle class, the call would be set(myObj,'my3Vector',[1 1]) and there would be no problem. But I don't think I want a handle class for this application (though I could be wrong, being relatively new to OOP).
Is there a workaround I'm missing? I tried putting try-catch blocks in my test file, but it just errored out in the try block (I suppose the point of the test framework is to not use complicated try-catch expressions).
Any advice would be appreciated. Don't know if it matters, but I'm using R2010b.