Display the input options for functions with multiple input arguments

조회 수: 24 (최근 30일)
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

채택된 답변

Kodavati Mahendra
Kodavati Mahendra 2018년 6월 8일
편집: Kodavati Mahendra 2018년 6월 8일
I think they did not add this feature for R2018A
https://stackoverflow.com/questions/19413841/multiple-tooltip-input-suggestions-for-matlab-function

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by