Creating a function with varying numbers of input parameters

18 ビュー (過去 30 日間)
Sebastian Daneli
Sebastian Daneli 2020 年 9 月 29 日
回答済み: Abdolkarim Mohammadi 2020 年 9 月 29 日
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
Abdolkarim Mohammadi 2020 年 9 月 29 日
You should use Variable-length input argument list using varargin().

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGraphics Objects についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by