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

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

[Octave-bug-tracker] [bug #61898] subsref: Error when field syntax is us


From: Pantxo Diribarne
Subject: [Octave-bug-tracker] [bug #61898] subsref: Error when field syntax is used on non-scalar @class object
Date: Wed, 2 Feb 2022 16:03:02 -0500 (EST)

Follow-up Comment #1, bug #61898 (project octave):

I don't know if it is a proper "fix", but, as a workaround, the following
makes the example code work for me:


--- /home/pantxo/octave/interval-3.2.1/@infsup/subsref.m        2022-02-02
21:53:36.977512944 +0100
+++
/home/pantxo/.local/share/octave/api-v57/packages/interval-3.2.1/@infsup/subsref.m
      2022-02-02
21:55:23.258076894 +0100
@@ -52,7 +52,7 @@
 ## Keywords: interval
 ## Created: 2014-10-29
 
-function A = subsref (A, S)
+function varargout = subsref (A, S)
 
   if (nargin ~= 2)
     print_usage ();
@@ -89,6 +89,8 @@
     A = subsref (A, S(2 : end));
   endif
 
+  varargout{1} = A;
+
 endfunction
 
 %!assert (infsup (magic (3))([1, 2, 3]) == magic (3)([1, 2, 3]));


In short, the builtin octave_class::subsref which ultimately calls the user
defined one, is the same as for struct objects. For "." indexing on arrays it
thus expects that subsref will return as many outputs as the number of
elements in the array.


    _______________________________________________________

Reply to this item at:

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

_______________________________________________
  Message posté via Savannah
  https://savannah.gnu.org/




reply via email to

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