Question

Does any one would know a way of overriding the data tooltip that is shown when hovering over a variable when we are in the Matlab editor ? I have a custom class that is relatively simple and its content could be shown easily in the tool tip, but Matlab insists on saying it is a 1x1 CustomClass, which is nice and all, but it would be more useful if we could make it to show the content of the object in a nice way. Right now, I have to type the name of the variable in the cmd window e.g. when debugging instead of a short hover on the variable name. Nitpicky, but I'd find it interesting ^^

I've tried to dig a bit using undocumented leads on data tooltips, e.g. http://undocumentedmatlab.com/blog/accessing-the-matlab-editor/ http://undocumentedmatlab.com/blog/spicing-up-matlab-uicontrol-tooltips/

But I don't have the final answer, anyone has any ideas ?

Was it helpful?

Solution

The tooltip seems to get its string by using the disp method. Override disp on your class. In the method body, construct your desired string however you want and then call disp on it. In R2012a at least this works for the debugger tooltip.

Note that you'll need to do a clear classes after editing the class to get MATLAB to recognize the overridden disp.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top