bugGNU Octave - Bugs: bug #44659, stem does not accept logical inputs

 
 

bug #44659: stem does not accept logical inputs

Submitter:  None
Submitted:  Sun 29 Mar 2015 08:39:58 AM UTC
   
 
Category:  Plotting Severity:  2 - Minor
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  None
Originator Name:  Miljenko Jakovljevic Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 3.6.4
Operating System:  * GNU/Linux Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 30 Mar 2015 05:38:16 AM UTC, comment #5: 

Okay.  I expanded stem to accept logical arguments in this cset (http://hg.savannah.gnu.org/hgweb/octave/rev/185e8dbdaa40).  This will be a part of the 4.0 release.  Closing report.

Rik <rik5>
Group administrator
Mon 30 Mar 2015 04:15:52 AM UTC, comment #4: 

Matlab r2009b says:

>> stem (1:3, ['A', 'B', 'C'])

??? Error using ==> stem at 40
Error in color/linetype argument.
 
My newer Matlab has died for some reason, but
I doubt if there has been a change.

Michael Godfrey <godfrey>
Group Member
Mon 30 Mar 2015 01:34:19 AM UTC, comment #3: 

Actually, a more interesting test would be if Matlab accepts char values.


stem (1:3, ['A', 'B', 'C'])


If they do, then Octave can just use isreal() to validate inputs.  Otherwise, one has to use a combination such as:


isreal (X) && ! ischar (X)
or
isnumeric (X) || islogical (X)



Rik <rik5>
Group administrator
Mon 30 Mar 2015 01:25:17 AM UTC, comment #2: 

We can wait for confirmation, but according to Matlab's documentation the acceptable input is


single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | logical


So it looks like logical is accepted.  In terms of memory, it might be cheapest to convert any logicals to uint8 (1 byte) rather than double (8 bytes).

Rik <rik5>
Group administrator
Sun 29 Mar 2015 12:33:33 PM UTC, comment #1: 

Hi,

Thanks for your bug report. You are using a pretty old version of Octave. Since then things have changed: 3.8.1 triggers another error message


error: invalid value for array property "ydata"
error: called from:
error:   /usr/share/octave/3.8.1/m/plot/draw/private/__stem__.m at line 135, column 7
error:   /usr/share/octave/3.8.1/m/plot/draw/stem.m at line 127, column 8



4.0.0rc1 explicitly says that inputs should be numeric (not boolean as in your example):


error: stem: X and Y must be numeric
error: called from
    __stem__>check_stem_arg at line 254 column 7
    __stem__ at line 37 column 40
    stem at line 127 column 8


Can you check how Matlab handles this example? Do they turn bool into double?

Pantxo Diribarne <pantxo>
Group Member
Sun 29 Mar 2015 08:39:58 AM UTC, original submission:  

A = [1,2,3];
B = [0,2,0];
C = (A == B);
stem(A,C);

warning: implicit conversion from matrix to sq_string
error: get: unknown line property 
error: called from:
error:   /usr/share/octave/3.6.4/m/plot/private/__line__.m at line 113, column 16
error:   /usr/share/octave/3.6.4/m/plot/line.m at line 38, column 5
error:   /usr/share/octave/3.6.4/m/plot/private/__plt__.m at line 597, column 12
error:   /usr/share/octave/3.6.4/m/plot/private/__plt__.m at line 238, column 14
error:   /usr/share/octave/3.6.4/m/plot/private/__plt__.m at line 99, column 17
error:   /usr/share/octave/3.6.4/m/plot/plot.m at line 196, column 9
error:   /usr/share/octave/3.6.4/m/plot/private/__stem__.m at line 97, column 17
error:   /usr/share/octave/3.6.4/m/plot/stem.m at line 81, column 7

Anonymous

 

(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 godfrey (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by pantxo (Posted a comment)
  • -email is unavailable- added by None (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 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-03-30 rik5 StatusNeed Info Fixed
        Open/ClosedOpen Closed
    2015-03-30 rik5 Severity3 - Normal 2 - Minor
    2015-03-30 rik5 SummaryPlotting the result of (==) comparison of two vectors does not plot properly stem does not accept logical inputs
    2015-03-30 rik5 StatusNone Need Info

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code