Display the input options for functions with multiple input arguments
23 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Stephan
am 8 Jun. 2018
Bearbeitet: Kodavati Mahendra
am 8 Jun. 2018
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
0 Kommentare
Akzeptierte Antwort
Kodavati Mahendra
am 8 Jun. 2018
Bearbeitet: Kodavati Mahendra
am 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
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!