octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Another request for classdef test in Matlab


From: Michael D. Godfrey
Subject: Re: Another request for classdef test in Matlab
Date: Fri, 04 Jan 2013 23:48:57 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0

On 01/04/2013 10:49 PM, Michael Goffioul wrote:
On Fri, Jan 4, 2013 at 5:57 PM, Ben Abbott <address@hidden> wrote:
Ok. That behaves like a structure, and returns a cs-list.

Does that behavior also apply for methods?

Having the following class:

classdef ClassA < handle
  properties
    x = 1;
  end
  methods
    function obj = ClassA (x)
      if nargin > 0
        obj.x = x;
      end
    end
    function out = m1 (obj)
      disp ('m1');
      out = 0;
  end
end

What's the result of the following:

clear all
a(2,2) = ClassA (2)
a.m1()

Michael.

After adding an end to the class def, I got:

>> a(2,2)=ClassA(2)

a =

  2x2 ClassA handle

  Properties:
    x


>> a.m1()
m1

ans =

     0

>>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]