OOP in v3.2: command struct() with objects

View: New views
4 Messages — Rating Filter:   Alert me  

OOP in v3.2: command struct() with objects

by WMennerich :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
given a user defined matlab object, you can change it to a structure which has the same shape
as the structure you used for the object ceation. This does not work in Octave v3.2 .

Example:
Assuming a created object 'myobject' with attributes 'att1' and 'att2'.

>result=myobject.att1;

would give an error, since all attributes of 'myobject' are private, but in matlab you can do:

>structObj=struct(myobject);
>result=structObj.att1;

StructObj is just a structure with fields from the object attributes.

If you use struct() on an array of objects, matlab gives you a struct array. This opens different possibilites to work vectorized with objects,
e.g. to filter objects with a certain content in their attributes.

Best, Wolfgang

Re: OOP in v3.2: command struct() with objects

by WMennerich :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Does somebody now whether this struct()-functionality is already implemented and just does not work or is not yet implemented?
To repead it shortly:
      struct() is the counterpart to class(<struct>,<class name>)

Thanks, Wolfgang

Re: OOP in v3.2: command struct() with objects

by John W. Eaton-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 18-Jun-2009, WMennerich wrote:

| Does somebody now whether this struct()-functionality is already implemented
| and just does not work or is not yet implemented?
| To repead it shortly:
|       struct() is the counterpart to class(<struct>,<class name>)

Both struct and class are implemented in the current version of
Octave, 3.2.x.  If they don't work as you expect, or you are trying to
report a bug, then please explain exactly what you tried, what
happened, and what you expected to happen.

You can find other bug reporting tips here:

  http://www.octave.org/bugs.html

jwe
_______________________________________________
Bug-octave mailing list
Bug-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/bug-octave

Re: OOP in v3.2: command struct() with objects

by WMennerich :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Sorry, that was a false alert, I wrote a test class and now it works fine.
Doing this, I found another bug (cellfun with handles from overloaded functions does not work).
But before posting a bug report, I must do some more tests to get the exact problem.

Thanks, Wolfgang