[SciPy-User] MATLAB accumarray equivalent ?

Mohammad Abdollahi m.abdollahi@gmail....
Wed Mar 31 06:20:58 CDT 2010


Dera Herlad

Thank you for your reply. so what i'm trying to do is to create a
re-assigned spectrogram. which means that i have a 2-d matrix representing
my weighted spectrogram that i want to operate on this matrix in a way that
the value of each element in matrix will be reassigned based on the value of
the neighbouring elemnts of it. (i.e the sum of the values of some
neighbours). for that purpose i was using accumarray in matlab which is very
efficient that the trivial way of using for loops that comes to mind first.
and the way i used the accumarray in matlab was sth like this : (very simple
example)

>> subs = [1:6;6:-1:1]

subs =

     1     2     3     4     5     6
     6     5     4     3     2     1

>> val = 10:15

val =

    10    11    12    13    14    15

>> accumarray(subs',val)

ans =

     0     0     0     0     0    10
     0     0     0     0    11     0
     0     0     0    12     0     0
     0     0    13     0     0     0
     0    14     0     0     0     0
    15     0     0     0     0     0


regards
Mohammad

On Wed, Mar 31, 2010 at 12:33 PM, Harald Schilly
<harald.schilly@gmail.com>wrote:

> On Wed, Mar 31, 2010 at 12:28, Mohammad Abdollahi <m.abdollahi@gmail.com>
> wrote:
> > but apparently they can not be used when subs
> > is a matrix. i.e. the output of the function is meant to be a matrix too.
> > right ?
>
> Can you please explain what you wanna do? Maybe there is another
> function that does what you want or it is done in another way. Numpy
> is not a 1:1 matlab clone!
>
> greetings harald
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20100331/673a6c17/attachment.html 


More information about the SciPy-User mailing list