help-octave
[Top][All Lists]
Advanced

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

RE: class() and MATLAB compatibility


From: Billings, Paul
Subject: RE: class() and MATLAB compatibility
Date: Wed, 10 May 2006 13:58:47 -1000

My understanding is that presently octave does not have support for user
defined types in .m files.  You can achieve it through writing a .oct file,
but it is a painful process (compared to how easy Matlab makes it).

There has been talk of adding this capability to octave in a future version;
the archives should have some mention of it.  I could be wrong, but I don't
think there is anyone working on it at the moment.

Paul


> -----Original Message-----
> From: address@hidden
> [mailto:address@hidden Behalf Of Paul Koufalas
> Sent: Wednesday, April 19, 2006 10:18 PM
> To: address@hidden
> Subject: class() and MATLAB compatibility
>
>
> 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
>
>
>
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://www.cae.wisc.edu/mailman/listinfo/help-octave


reply via email to

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