Clear Filters
Clear Filters

Display the input options for functions with multiple input arguments

24 views (last 30 days)
Hi,
I have a function that takes more than one input argument - see my example where there are 2 arguments:
function z = example(x,y)
if nargin == 0
x = 1;
y = 1;
elseif nargin == 1
y = 1;
end
z = x + y;
end
The number of input arguments is flexible from 0 to 2. If there is no argument, put x and y equal to one. If there is only one input argument, let x assume the value of the input argument and y equal one. For both arguments x and y should accept the given value.
Using the function:
nargin
this part works. Now I have the question how I adjust the tooltip when entering so that the user is shown that he has several options. In my case he could call the function in 3 ways and there would be a result. To illustrate my question I have inserted two pictures:
.
.
You can see here, as it is at e.g. linprog works - mab gets displayed in the tooltip which variants the function can handle.
For my example, this does not work - here is only one variant that the user gets displayed, although 3 are possible:
.
.
From C # I know this procedure as overriding functions, but I know that there is not overriding in matlab in this form. How can I extend this tooltip to show all possible calls to my function as a tooltip?
.
Best regards
Stephan

Accepted Answer

Kodavati Mahendra
Kodavati Mahendra on 8 Jun 2018
Edited: Kodavati Mahendra on 8 Jun 2018
I think they did not add this feature for R2018A
https://stackoverflow.com/questions/19413841/multiple-tooltip-input-suggestions-for-matlab-function

More Answers (0)

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Products


Release

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!