bugGNU Octave - Bugs: bug #62000, meta.Class properties are...

 
 

bug #62000: meta.Class properties are generally object arrays in Matlab, Cell array in Octave

Submitter:  Richard <crobar>
Submitted:  Mon 07 Feb 2022 12:12:31 PM UTC
   
 
Category:  Classdef Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Confirmed Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 07 Feb 2022 08:52:44 PM UTC, comment #4: 

See also bug #55865

A.R. Burgers <arb>
Mon 07 Feb 2022 12:55:01 PM UTC, comment #3: 

Title good now thanks

Richard <crobar>
Mon 07 Feb 2022 12:31:34 PM UTC, comment #2: 

Adapted for you. Title OK now?

Philip Nienhuis <philipnienhuis>
Group Member
Mon 07 Feb 2022 12:13:28 PM UTC, comment #1: 

Doh, I meant to make the title meta.Class properties are generally object arrays in Matlab, Cell array in Octave

Richard <crobar>
Mon 07 Feb 2022 12:12:31 PM UTC, original submission:  

meta.Class properties are generally object arrays in Matlab, Cell array in Octave.

e.g. when one calls meta.class.fromName on a class name in Matlab, the returned meta.Class object has a field 'MethodList'. In Octave this is a Cell array of meta.Method objects, in Matlab it is an object array, not a cell array.

This appears generally true of the meta.Class properties, here's an example:

Octave:


class_info =

  meta.class object with properties:

                 Abstract: 0
          ConstructOnLoad: 0
        ContainingPackage: [1x1 meta.package]
              Description:
      DetailedDescription:
                   Events: [0x0 cell]
         HandleCompatible: 1
                   Hidden: 0
          InferiorClasses: [0x1 cell]
               MethodList: [34x1 cell]
                  Methods: [34x1 cell]
                     Name: <redacted>
               Properties: [43x1 cell]
             PropertyList: [43x1 cell]
                   Sealed: 0
           SuperClassList: [1x1 cell]
             SuperClasses: [1x1 cell]
           SuperclassList: [1x1 cell]


Matlab:


K>> class_info

class_info =

  class with properties:

                     Name: <redacted>
              Description: ''
      DetailedDescription: ''
                   Hidden: 0
                   Sealed: 0
                 Abstract: 0
              Enumeration: 0
          ConstructOnLoad: 0
         HandleCompatible: 1
          InferiorClasses: {0×1 cell}
        ContainingPackage: [1×1 meta.package]
     RestrictsSubclassing: 0
             PropertyList: [43×1 meta.property]
               MethodList: [57×1 meta.method]
                EventList: [1×1 meta.event]
    EnumerationMemberList: [0×1 meta.EnumeratedValue]
           SuperclassList: [1×1 meta.class]


This was relevant for me as I have some code that expected the alternative:


all_method_names = arrayfun (@(x) x.Name, class_info.MethodList,
'UniformOutput', false);


I get the error "error: cell cannot be indexed with ." as it is a cell, not an object.

Richard <crobar>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Updated the item)
  • -email is unavailable- added by arb (Posted a comment)
  • -email is unavailable- added by crobar (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-01-18 rik5 StatusNone Confirmed
    2024-01-18 rik5 Dependencies- Depends on bugs #65179
    2022-03-04 mmuetzel Carbon-CopyRemoved 102357 -
    2022-03-04 mmuetzel CategoryOctave Function Classdef
        Release6.4.0 dev
        Dependencies- Depends on bugs #55865
    2022-02-07 philipnienhuis Summarymeta.class.fromName properties are generally object arrays in Matlab, Cell array in Octave meta.Class properties are generally object arrays in Matlab, Cell array in Octave

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code