bugGNU Octave - Bugs: bug #34038, deblank does not work on indexed...

 
 

bug #34038: deblank does not work on indexed cells

Submitted by:  Ben Barrowes <barrowes>
Submitted on:  Wed 17 Aug 2011 06:32:14 PM UTC  
 
Category: InterpreterSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: FixedAssigned to: None
Originator Name: Ben BarrowesOpen/Closed: Closed
Release: devOperating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Mon 22 Aug 2011 05:21:22 AM UTC, comment #4:

Seems to me that the docstring is still unclear. "Recursive" to me suggest the following should work:

but it doesn't. What's wrong, the docstring or the function?

Jordi GutiƩrrez Hermoso <jordigh>
Project Administrator
Mon 22 Aug 2011 04:53:58 AM UTC, comment #3:

The Octave docstring is old and seems to have been written when there was not much distinction between a cell and a cell array of strings.

The deblank() documentation for ML (http://www.mathworks.com/help/techdoc/ref/deblank.html) is much clearer. It specifies only two calling forms. One for character arrays and one for cellstrs.

I've added a changeset which clarifies that cell arrays of strings, not cells alone, are the desired input. I also added notes to the NEWS file since a number of the functions in the strings directory have been reworked. http://hg.savannah.gnu.org/hgweb/octave/rev/4ec4096f65d1

Rik <rik5>
Project Administrator
Fri 19 Aug 2011 05:45:59 AM UTC, comment #2:

Was this the right fix? The docstring says deblank should operate recursively on cell arrays, not just cellstrings, and this is a regression from 3.4.2 in which this command did work as Ben expected it to. The deblank function used to only warn when being passed non-string arguments, but erroring out seems too severe to me. I think GIGO with warning is fair game.

Jordi GutiƩrrez Hermoso <jordigh>
Project Administrator
Fri 19 Aug 2011 05:29:39 AM UTC, comment #1:

Octave, in general, is more careful about checking its inputs than Matlab. More often than not this is a good thing because it prevents Garbage In/Garbage Out where you thought you were feeding something compatible to a function but in fact were not.

In this case, Octave should not have allowed a cell as input. The function only works properly for character arrays and cellstrings. I've checked in a changeset (http://hg.savannah.gnu.org/hgweb/octave/rev/f89449967f0d) which enforces this.

Rik <rik5>
Project Administrator
Wed 17 Aug 2011 06:32:14 PM UTC, original submission:

Octave produces an error when a index cell is passed to deblank.

In octave:

octave:6> aa=cell(1,2)
aa =
{
[1,1] = [](0x0)
[1,2] = [](0x0)
}
octave:7> deblank(aa)
warning: implicit conversion from matrix to sq_string
warning: implicit conversion from matrix to sq_string
warning: implicit conversion from matrix to sq_string
warning: implicit conversion from matrix to sq_string
ans =
{
[1,1] = [](0x0)
[1,2] = [](0x0)
}
octave:8> deblank(aa{1})
error: deblank: S argument must be a string or cellstring
error: called from
deblank at line 50 column 5
stopped in /usr/local/share/octave/3.5.0+/m/strings/deblank.m
debug>

While in matlab:

>> aa=cell(1,2)

aa =
[] []

>> deblank(aa)

ans =
[] []

>> deblank(aa{1})

ans =
[]

>>

Ben Barrowes <barrowes>

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by jordigh (Posted a comment)
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by barrowes (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 19 Aug 2011 05:29:39 AM UTCrik5StatusNone=>Fixed
      Open/ClosedOpen=>Closed
      Summarydebalnk does not work on indexed cells=>deblank does not work on indexed cells

    Back to the top


    Powered by Savane 3.1-cleanup1