methods

Begins a methods block within a class definition.

Syntax

methods

methods(Access = [Public | Private])

methods(Static = [true | false])

Inputs

Example

Defining a new class named Circle that has both static and regular methods:
classdef Shape < handle
             properties %default Access is public
                 radius
             end
              properties 
                 center_x
                 center_y
             end
             methods
                  function self=Shape(r)
                     self.radius = r;
                     self.center_x = 0.0;
                     self.center_y = 0.0;
                  end
             end
             methods (Static = true)
                 function c = circumference(radius)
                     c = 2 * pi() .* radius;
                 end
             end
         end