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

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

[Octave-bug-tracker] [bug #51785] Inconsistent behavior of various shape


From: Geoffrey Adams
Subject: [Octave-bug-tracker] [bug #51785] Inconsistent behavior of various shaped empty index vectors in for loops
Date: Fri, 18 Aug 2017 13:52:08 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36

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

                 Summary: Inconsistent behavior of various shaped empty index
vectors in for loops
                 Project: GNU Octave
            Submitted by: biogeo
            Submitted on: Fri 18 Aug 2017 05:52:06 PM UTC
                Category: Interpreter
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: Geoffrey Adams
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.0.3
        Operating System: GNU/Linux

    _______________________________________________________

Details:

When supplying an empty matrix as the index vector to a for loop, the expected
behavior is that the loop body is skipped, as in the following:


for i=[]
    disp('This will never execute');
end


However, for empty matrices that are not shaped as 0-by-0, this is not always
the case. In particular, while the following behaves as expected:


for i=reshape([],1,0)
    disp('This will never execute');
end


the following does not:


for i=reshape([],0,1)
    disp('This line executes, and i is a 0-by-1 matrix');
    disp(i);
end





    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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