How can I define multiple named inputs for a function

This is exactly what I mean!!
The default function eye() admits multiple variables, something like varargin.
Other property is that it displays all the different possibilities!
If someone can help me, I'll be very grateful!
Thank you very much
Iagoba

답변 (1개)

Amit
Amit 2014년 1월 27일

0 개 추천

댓글 수: 3

Hello:
thanks for answering my question. But the example you give me produces just one line of helping dialog, even for varargin.
And I am trying to find a way to display more that a single line help dialog for my function, this way the function would be more helpful in the future.
thanks again
If you want really a fancy tab completion, see this: http://undocumentedmatlab.com/blog/setting-desktop-tab-completions/
for a relatively simple one:
function a = myfunc(var1,var2,var3)
if nargin < 1
var1 = defaultvalueforvar1;
end
if nargin < 2
var2 = defaultvalueforvar1;
end
if nargin < 3
var3 = defaultvalueforvar1;
end
end
This will show tab completion for all 3 variable, however only 1 or less than 1 variable needed.
Thanks!! It sounds good! I'll take a look.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

질문:

2014년 1월 27일

댓글:

2014년 1월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by