help-octave
[Top][All Lists]
Advanced

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

class() and MATLAB compatibility


From: Paul Koufalas
Subject: class() and MATLAB compatibility
Date: Thu, 20 Apr 2006 17:48:29 +0930
User-agent: Mozilla Thunderbird 1.0.7 (X11/20051013)

G'day all.

I have a 3rd party MATLAB toolbox that relies on user-defined classes.

The following is an extract from the MATLAB help reference:

1. obj = class(object)

2. obj = class(s, 'class_name') creates an object of MATLAB class
'class_name' using structure s as a template. This syntax is valid only
in a function named class_name.m in a directory named @class_name (where
'class_name' is the same as the string passed in to class).

3. obj = class(s, 'class_name', parent1, parent2, ...) creates an object
of MATLAB class 'class_name' that inherits the methods and fields of the
parent objects parent1, parent2, and so on. Structure s is used as a
template for the object.

4. obj = class(struct([]), 'class_name', parent1, parent2, ...) creates
an object of MATLAB class 'class_name' that inherits the methods and
fields of the parent objects parent1, parent2, and so on. Specifying the
empty structure struct([]) as the first argument ensures that the object
created contains no fields other than those that are inherited from the
parent objects.

My understanding is that Octave only supports form 1, at least in 2.1.71:

octave:1> help class
class is a built-in function

 -- Built-in Function:  class (EXPR)
     Return the class of the expression EXPR, as a string.

Most of the class() usage in this 3rd party MATLAB toolbox is of the form 3.

Does anyone have any ideas on how to proceed, or does this make it a
dead-end for using this toolbox under Octave? I understand the authors
of the toolbox did consider porting it to Octave, and stopped for this
reason (as well as for an invalid reason, i.e. perceived lack of cell
array support).

Cheers





reply via email to

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