Creating a function with varying numbers of input parameters

20 次查看(过去 30 天)
Hi
I am writing a function to plot data for me in different ways. I would like to decide in which way to plot the data when i call the function. For example, if i write
myfunction(f,k,'stem')
then I would like the result to be a stem plot. If i were to write
myfunction(f,k)
then the result should be different, but nevertheless work.

采纳的回答

Abdolkarim Mohammadi
You should use Variable-length input argument list using varargin().

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by