Define matlab functions with input selected from a "list"

7 visualizaciones (últimos 30 días)
Elia Peruzzo
Elia Peruzzo el 9 de Mayo de 2018
Respondida: Steven Lord el 9 de Mayo de 2018
Hi everyone,
Maybe the title dosen't explin my problem, so I'll provide an example. When I define a function with "classical" notation:
function output = myFnc(input)
end
I would like to obtain something like:
c = cvpartition(group,'KFold',k,'Stratify',stratifyOption)
Basically I want to choose a 'Method' from a list. When I call the function I would like to have
a = myFcn('Method', Gradient)
What is the code that allows me to do so?
Thank you :)

Respuestas (1)

Steven Lord
Steven Lord el 9 de Mayo de 2018
If I understand your description correctly, it sounds like you want to implement tab completion for your function. If you're using release R2018a, see this page in the documentation for instructions on how to create the file that tab completion will use for your function (or functions in a particular directory).

Categorías

Más información sobre Startup and Shutdown en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by