[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: vectorise matrix slice extraction
From: |
Jaroslav Hajek |
Subject: |
Re: vectorise matrix slice extraction |
Date: |
Fri, 27 Feb 2009 19:25:15 +0100 |
On Fri, Feb 27, 2009 at 2:59 PM, Francesco Potorti` <address@hidden> wrote:
> Is there a way to efficiently remove the for loop in this assignment?
>
> for jj = length(pple):-1:1
> llk(:,:,:,jj) = ll(:,:,:,pple(jj),tple(jj));
> endfor
>
> --
n = length (pple);
i = sub2ind(size (ll) (4:5), pple, tple);
llk(:,:,:,1:n) = ll(:,:,:,i);
--
RNDr. Jaroslav Hajek
computing expert
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz