[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Vectorisation
From: |
Jaroslav Hajek |
Subject: |
Re: Vectorisation |
Date: |
Wed, 7 Jul 2010 20:57:41 +0200 |
On Wed, Jul 7, 2010 at 7:15 PM, Judd Storrs <address@hidden> wrote:
>> octave1:>count = zeros(1,20);
>> octave2:>for i = 1:length(data)
>> octave3:> count(data(i, 3))++;
>> octave4:>endfor
>
> count = histc(data(:,3),1:20)
>
or more directly (histc uses lookup & accumarray under the hood for
more than 3 bins)
count = accumarray (data(:,3), 1, [1, 20]);
accumarray can handle a lot, it's good to know about it :)
--
RNDr. Jaroslav Hajek, PhD
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz
- Vectorisation, gastonjulia, 2010/07/07
- Re: Vectorisation, Jordi Gutiérrez Hermoso, 2010/07/07
- Re: Vectorisation, Andy Buckle, 2010/07/07
- Re: Vectorisation, Judd Storrs, 2010/07/07
- Re: Vectorisation,
Jaroslav Hajek <=
- Re: Vectorisation, gastonjulia, 2010/07/08
- Re: Vectorisation, Jaroslav Hajek, 2010/07/08
- Re: Vectorisation, gastonjulia, 2010/07/08
- Re: Vectorisation, gastonjulia, 2010/07/22
- Re: Vectorisation, Jaroslav Hajek, 2010/07/23
- Re: Vectorisation, gastonjulia, 2010/07/23
- Re: Vectorisation, Jaroslav Hajek, 2010/07/23
- Re: Vectorisation, gastonjulia, 2010/07/23