Ken & Mike on the MATLAB Desktop
October 20th, 2008
Function Hints
In MATLAB R2008b, your command line just got a heck of a lot smarter. We now have autocompletion for function parameters, which we call Function Hints. It’s simple to explain, and easy to use. If you typed “plot(” at the command line and waited a short time, you’d see the following:
Function Hints will show you which parameter you are currently editing in bold. The list of function signatures narrows as you type to exclude non-matching signatures.
This feature works with all our supplied functions as well as any you write. You get this feature automatically when your function is on the MATLAB path. The picture below is from myfun.m that has the following signature:
function myfun(x,y)
Function Hints is available in both the Command Window and the Editor, and can be turned off in the Preferences (File > Preferences > Keyboard).
This has been an oft-requested feature, and we’re really proud that we can finally share it with you.
By
Michael Katz
Mike is a developer on the MATLAB Desktop team. When not describing himself in the third person, biking, homebrewing, or rooting for the home team, he's busy trying to make the world a better place for programming.
11:51 UTC |
Posted in Command Window, Editor |
Permalink |
You can follow any responses to this entry through the RSS 2.0 feed.
You can skip to the end and leave a response. Pinging is currently not allowed.
Leave a Reply
|
I’m noticing this only is working for functions that have the function signature as the first line of the file. I guess I’ve been wrongly putting the function help text first? Would be very nice to know how to put hints for alternate syntax into my functions.
Hi Mike,
These features are very helpul. It would be great to have the same functionnality in the Interactive Parrallel Command Window ;-)
PS: I understand better why it was difficult to reach MATLAB Central this morning. The new design of the webpage is really good!
Aurélien
@Ryan,
So it is. I will let the developer know about the first line thing. As for the alternate syntax, I will create an enhancement request for that.
@Aurélien,
I will create an enhancment request for those developers. Thanks.
Now that I have been using Amtlab with function hints for a few months, I have to say that they have proven to be much less usefull than I had hoped.
I find them far too slow to pop up and far to fragile once they have popped up.
It would be nice to have a button one could press to force the function hints to appear, similar to the way pressing tab makes the tab completion popup appear.
Daniel,
Thanks for the suggestion, it certainly would be handy.
Hi, two questions:
1. How can I create a custom list of function hints?
2. How can I get some function hints to list when there is a varargin input?
for example, if I have a function:
function output = myfun(varargin)
…
end
function hints will not list when myfun is typed on the command line, but i would like to list some.
Thanks!
Jon,
We currently don’t have a way to specify custom (or even more than one) hint for a user function.
I have reported the varargin issue to the developers.
Thanks!