octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #62000] meta.class.fromName properties are gen


From: Richard
Subject: [Octave-bug-tracker] [bug #62000] meta.class.fromName properties are generally object arrays in Matlab, Cell array in Octave
Date: Mon, 7 Feb 2022 07:12:33 -0500 (EST)

URL:
  <https://savannah.gnu.org/bugs/?62000>

                 Summary: meta.class.fromName properties are generally object
arrays in Matlab, Cell array in Octave
                 Project: GNU Octave
            Submitted by: crobar
            Submitted on: Mon 07 Feb 2022 12:12:31 PM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Matlab Compatibility
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
                 Release: 6.4.0
         Discussion Lock: Any
        Operating System: Any

    _______________________________________________________

Details:

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.





    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?62000>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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