I notice on built in Matlab functions there can be multiple lines of possible input configurations like this
as opposed to just
I have to assume they use something akin to inputParser
with the use of varargin
, but I have been unsuccessful in trying to replicate this functionality. I would like to have the ability to do this but I'm starting to get the feeling this is only something you can do with built in functions.
Somethings that I have thought of or tried are:
inputParser
(unsuccessful)Has anyone been able to do this?
I have built a similar tool in the past that works quite well. Unfortunately it's a proprietary in-house tool so I can't share the actual tool. However I can tell you that after investigating several options (similar to those you listed) we decided to use a special syntax for our help comments (similar to Markdown or restructuredText) that supports the declaration of syntax variants.
The information from the help texts is then parsed by the tool and can be displayed in different manners (e.g. by shadowing the original doc
command with a custom one).
Regarding the actual pop-up menu you may try to dig into the internals of the command window. Yair Altman has documented many unofficial ways to enhance the MATLAB GUI on his wonderful blog. For example, here's a post that describes how to add tab-completion to custom commands.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With