bugGNU Octave - Bugs: bug #55976, cat, repmat, and reshape don't...


bug #55976: cat, repmat, and reshape don't work for classdef objects

Submitted by:  Andrew Janke <apjanke>
Submitted on:  Fri 22 Mar 2019 12:52:24 AM UTC  
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  None Assigned to:  None
Originator Name:  Open/Closed:  Open
Release:  4.4.1 Operating System:  Any

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Tue 26 Mar 2019 11:06:30 PM UTC, comment #3:

Oh, wait, I can do it with indexing: `x = MyObject; empty_obj = x([]);`.

Andrew Janke <apjanke>
Tue 26 Mar 2019 09:27:27 PM UTC, comment #2:

One downside of this is that I can't figure out how to create an empty array of default-implementation struct-organized objects. The normal way to do this in Matlab seems to be `repmat(MyObject, [0 0])`, but without repmat, I can't do that.

This means that for default-implementation struct-organized classes, I can't represent the empty set with the appropriate type, and have to fall back on using double `[]`, which doesn't have the same operations as the class, so clients have to include special-case logic for empties.

Andrew Janke <apjanke>
Fri 22 Mar 2019 12:53:08 AM UTC, comment #1:

Related: bug #44665.

Andrew Janke <apjanke>
Fri 22 Mar 2019 12:52:24 AM UTC, original submission:

It seems that cat, its [...] equivalent, reshape, and repmat are not working for classdef objects. This is a bummer, because these are kind of basic elements of OOP M-code programming if you're not going to go all the way and make planar-organized objects.

Lets's say I have a class packajoozle.internalVersion with properties string, elements, and suffix. https://github.com/apjanke/octave-packajoozle/blob/679b4afc3e5e706f6b9ca259705102d0edc077e6/inst/%2Bpackajoozle/%2Binternal/Version.m It does not override size, cat, reshape, numel, or any of the other structural methods; it is a regular struct-organized object.

Trying to do [...], reshape, or repmat on it produces an Octave error.

That's from Octave 4.4.1. Same thing happens in Octave 5.1.0 and Octave default 6.0.0 (hg id: 1771bed38482 + patches).

Andrew Janke <apjanke>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by apjanke (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.




    No changes have been made to this item

    Back to the top

    Powered by Savane 3.4