Borrar filtros
Borrar filtros

Display the input options for functions with multiple input arguments

24 visualizaciones (últimos 30 días)
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

Respuesta aceptada

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

Más respuestas (0)

Categorías

Más información sobre Get Started with MATLAB en Help Center y File Exchange.

Productos


Versión

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by