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

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

[Octave-bug-tracker] [bug #48867] delete elements from array with indire


From: Amro
Subject: [Octave-bug-tracker] [bug #48867] delete elements from array with indirect empty matrix
Date: Tue, 23 Aug 2016 10:57:07 +0000 (UTC)
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:48.0) Gecko/20100101 Firefox/48.0

URL:
  <http://savannah.gnu.org/bugs/?48867>

                 Summary: delete elements from array with indirect empty
matrix
                 Project: GNU Octave
            Submitted by: amro_octave
            Submitted on: Tue 23 Aug 2016 01:57:05 PM EEST
                Category: Interpreter
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: WTF, Matlab?!?
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.0.3
        Operating System: Any

    _______________________________________________________

Details:

In another thread <https://savannah.gnu.org/bugs/?45945#comment21>, @jwe
mentioned in a comment how "[]" is treated differently when deleting elements
from an array.

I did a quick test and I found another minor case where behavior is different
between MATLAB and Octave. I didn't wanna clutter the original thread with
unrelated discussion, so I'm reporting it here as a new bug (feel free to mark
it as low priority).

Here is an example (tested in Octave 4.0 and MATLAB R2016a, both on Windows):


x = 1:10;

% works in both MATLAB and Octave
x(1) = [];

% errors in both MATLAB and Octave
nil = []; x(1) = nil;
x(1) = double([]);
x(1) = zeros(0,0);

% works in both MATLAB and Octave
x = subsasgn(x, substruct('()',{1}), []);

% --> works in MATLAB, but errors in Octave! <--
x = subsasgn(x, substruct('()',{1}), nil);
x = subsasgn(x, substruct('()',{1}), double([]));
x = subsasgn(x, substruct('()',{1}), zeros(0,0));


So calling "subsasgn" with "nil" seems to work in MATLAB, even though the
equivalent syntax with direct assignment doesn't... Go figure :)





    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?48867>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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