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

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

[Octave-bug-tracker] [bug #55856] subsref called in a subscripted assign


From: Guillaume
Subject: [Octave-bug-tracker] [bug #55856] subsref called in a subscripted assignment operation
Date: Tue, 15 Sep 2020 07:16:29 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0

Follow-up Comment #2, bug #55856 (project octave):

¯\(°_o)/¯ with the foo class defined in comment #1, subsref is indeed
called in Matlab for f.a(end)=1;


>> f = foo ();   
>> f.a = 1;
subsasgn
>> f.a(1)
subsref
ans =
     1
>> f.a(end)
subsref
subsref
ans =
     1
>> f.a(end)=1
subsref
subsasgn
f = 
       foo object: 1-by-1


If I define an "end" method like this:


function ind = end(obj, k, n)
  disp ("end");
  ind = 1;
end


the above doesn't change and the new method is only called for:


>> f(end)
end
subsref
ans = 
  struct with fields:
    a: 1


    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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