1
1

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のClass内メソッドの書き方, 実行の仕方

Last updated at Posted at 2015-06-11

matlabのClassのコンストラクタ以外のmethodsは,C/C++と違って第一引数に対象のオブジェクト情報が来るようです.

mlclassmethods.m
classdef hogeclass
  property
    member
  end
  methods
    function hogefunction(this)
      this.member = hoge;
    end
  end
end

実行時は以下のコード

main.m
inst = hogeclass(); %インスタンスを生成
inst.hogefunction(); %Class定義では引数thisを記述するが,実行時は引数なし.
1
1
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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?