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

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

[Octave-bug-tracker] [bug #33523] Matlab compatibility issue with averag


From: Fred
Subject: [Octave-bug-tracker] [bug #33523] Matlab compatibility issue with averaging the 3rd dim of a 2-D array
Date: Mon, 27 Aug 2012 18:04:17 +0000
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:12.0) Gecko/20100101 Firefox/12.0

Follow-up Comment #17, bug #33523 (project octave):

Hi,
I have come across the same issue using octave recently (which I just switched
to). I completely agree with John's comment. In my example, I need to take the
mean of the 3rd dimension, but only in some arbitrary range (1:2 for instance)
which can happen to be singleton.

>> a = zeros(3,4,5); k=1:2;
>> mean(a(:,:,k),3)
ans =

        0        0        0        0
        0        0        0        0
        0        0        0        0

If the range appears to be singleton, it bugs:

>> k=1:1;
>> mean(a(:,:,k),3)
error: mean: DIM must be an integer and a valid dimension
error: called from:
error:   /usr/share/octave/3.4.2/m/statistics/base/mean.m at line 111, column
5

Strangely, I do not get a bug when doing the same thing on the second
dimension:

>> mean(a(:,k,k),2)
ans =

        0
        0
        0

This is due to the second dimension singleton being not removed. It does not
look coherent to me.

Is there any plan to get this corrected?

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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