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

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

[Octave-bug-tracker] [bug #60768] Error creating an array from a list of


From: Fernando
Subject: [Octave-bug-tracker] [bug #60768] Error creating an array from a list of objects
Date: Thu, 10 Jun 2021 13:52:55 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:89.0) Gecko/20100101 Firefox/89.0

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

                 Summary: Error creating an array from a list of objects
                 Project: GNU Octave
            Submitted by: tutissanalio
            Submitted on: jue 10 jun 2021 17:52:53 UTC
                Category: Interpreter
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Unexpected Error or Warning
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
                 Release: 6.2.90
         Discussion Lock: Any
        Operating System: GNU/Linux

    _______________________________________________________

Details:

I created a simple class like the following


classdef MyClass < handle
  properties
    data=0;
  end
  methods
    function obj=MyClass(data)
      obj.data=data;
    end
  end
end


Then, in octave, I cannot construct an array with two objects of the class in
this way:

>> a=MyClass(1);
>> x=[a,a]
warning: struct: converting a classdef object into a struct overrides the
access restrictions defined for properties. All properties are returned,
including private and protected ones.
warning: struct: converting a classdef object into a struct overrides the
access restrictions defined for properties. All properties are returned,
including private and protected ones.
error: octave_base_value::parent_class_name_list(): wrong type argument
'object'


The same sentences work without any problem in Matlab:

>> a=MyClass(1);
>> x=[a,a]
x = 
  1×2 MyClass array with properties:
    data


Note that the following works in octave (and Matlab):

>> x(1)=a;
>> x(2)=a;
>> x
x =
  MyClass object array with properties:
      data
>>  size(x)
ans =
   1   2





    _______________________________________________________

Reply to this item at:

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

_______________________________________________
  Mensaje enviado vía Savannah
  https://savannah.gnu.org/




reply via email to

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