1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【Matlab】自分用忘備録-関数偏

Last updated at Posted at 2020-05-22

引数のデフォルト値を設定する

・公式ページのリンク

・使用例

exampleFunc.m
function c = Func(a,b)

arguments %ルール1:必ず実行コード行の一番初めに記入する
    a = 100 %ルール2: すべての引数を列挙する。デフォルト値を設定しない場合は a のみ書く。
    b = 200 
end

c = a+b;
end

example.m
res = Func
%結果
%res = 300

res = Func(300)
%res = 500

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?