bugGNU Octave - Bugs: bug #50884, isfigure([]) = []

 
 

bug #50884: isfigure([]) = []

Submitter:  Muhali <muhali>
Submitted:  Wed 26 Apr 2017 03:32:19 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Works For Me Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 27 Apr 2017 03:33:03 PM UTC, comment #5: 

Okay.  So the current behavior is the desired behavior.  Closing report.

Rik <rik5>
Group administrator
Thu 27 Apr 2017 03:01:38 PM UTC, comment #4: 

To me this still looks like it's working correctly. Since isfigure and isaxes are more specific versions of ishandle, I would expect them to work similarly. The ishandle Matlab function returns an array that is the same size as the input array. So does the newer Matlab function isgraphics. So do the Octave functions isaxes and isfigure.

Mike Miller <mtmiller>
Group Member
Wed 26 Apr 2017 05:07:56 PM UTC, comment #3: 

Since isfigure() is an Octave-only feature, would it be useful to make a special case for isfigure and isaxes to return true/false for the empty case?

For programming, I try and follow the principle of Least Surprise.  In this case, since an empty matrix is not a figure, I would expect it to return false.

But, Octave might already be relying on the current behavior.

Rik <rik5>
Group administrator
Wed 26 Apr 2017 04:21:22 PM UTC, comment #2: 

To the second question, an empty double array is still numeric. An empty char array is not.


>> isnumeric ([])
ans = 1
>> isnumeric (single ([]))
ans = 1
>> isnumeric (char ([]))
ans = 0


IOW the dimensions of the array have nothing to do with whether it is numeric or a struct or real or complex, those properties apply to the entire array.

However each individual member of an array may be finite or infinite or may refer to a graphics handle or not.

Mike Miller <mtmiller>
Group Member
Wed 26 Apr 2017 04:19:05 PM UTC, comment #1: 

Well isnumeric, isstruct, isreal, iscomplex, etc, all test the properties of an entire array and return a single logical value.

The Matlab function ishandle, and the Octave extensions isaxes and isfigure, operate elementwise on the given array, so they return an array with the same dimensions as the input array. This is more comparable to the isfinite or isinf functions than isnumeric.

Think of isaxes, isfigure, and ishandle more like


>> [1 2 3] > 0
ans =

  1  1  1

>> [] > 0
ans = [](0x0)


Mike Miller <mtmiller>
Group Member
Wed 26 Apr 2017 03:32:19 PM UTC, original submission:  

Whereas isnumeric, isstruct, etc. return truth values for all arguments, we have

isfigure([]) = []

Is that on purpose? - Besides, why do we have

isnumeric([]) = 1 ?

Muhali <muhali>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by muhali (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-04-27 rik5 Open/ClosedOpen Closed
    2017-04-26 mtmiller StatusNone Works For Me

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code