How to implement function hints in your code
古いコメントを表示
I have seen that this has been asked previously, but never answered, and I want to know if this should go in as a feature request or if the capability is just not obvious.
When one starts typing e.g. 'plot(' and then waits, a series of suggested completions pops up. If I try this on my own code, it simply bases the suggestion on the top line. An abstract MWE example:
function out = foo(in, varargin)
p = inputParser;
addParameter(p,'mult',2)
parse(p,varargin{:})
out = in*p.Results.mult;
end
The function hint for this is 'foo(in,...)'.
Now, if I have a large number of possible inputs (similar to plot), I instead want the function hint to display some custom combinations of possible inputs as opposed to the single line based on the function definition. Preferably this would be based directly off of the comment header in the function file, although I could see it using an external file as well. This would be extremely helpful for building toolkits for other users.
Is this now possible? If not, I will submit it as a feature request.
Cheers, -Dan
1 件のコメント
Rik
2017 年 5 月 1 日
This is indeed an interesting question. (this comment is mostly to get in on my watch list)
採用された回答
その他の回答 (1 件)
Renan Thomes
2025 年 8 月 19 日
0 投票
Starting with MATLAB R2018a, you can personalize code suggestions and completions for your functions by following the Customize Code Suggestions and Completions documentation.
カテゴリ
ヘルプ センター および File Exchange で Adding custom doc についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!