mode returns a wrong answer for row vectors

David Bateman adb014 at gmail.com
Sun Mar 16 18:18:41 CDT 2008


David Bateman wrote:

> However, while looking at the way this failed, it points to another
> issue. Consider the indexing case
> 
> t = ones(3,3,3);
> t(:,4)
> t(true(3,1),4)
> 
> which with both Octave 3.1.x and MatlabR2007b return [1;1;1], where as
> 
> t(false(3,1),4)
> t([],4)
> 
> both return a 0-by-1 matrix in MatlabR2007b, but fail with an indexing
> error in Octave. My solution to this was to use the short_freeze
> indexing function even if one of the indices are empty. Is there a
> reason not to do this?
>

Ok, I can see why. If the trailing dimension is empty, my patch can't
work. Alternative fix attached..

D.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch7702
Url: https://www.cae.wisc.edu/pipermail/bug-octave/attachments/20080317/cdb14988/attachment.ksh 


More information about the Bug-octave mailing list