Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!news2.google.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post02.iad.highwinds-media.com!newsfe13.iad.POSTED!7564ea0f!not-for-mail
From: Walter Roberson <roberson@hushmail.com>
Organization: Canada Eat The Cookie Foundation
User-Agent: Thunderbird 2.0.0.17 (Windows/20080914)
MIME-Version: 1.0
Newsgroups: comp.soft-sys.matlab
Subject: Re: Vectorizing different parts of the same array
References: <gcd9os$6vt$1@fred.mathworks.com>
In-Reply-To: <gcd9os$6vt$1@fred.mathworks.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 10
Message-ID: <tsrGk.2538$S71.2267@newsfe13.iad>
NNTP-Posting-Host: 24.79.146.116
X-Complaints-To: internet.abuse@sjrb.ca
X-Trace: newsfe13.iad 1223312281 24.79.146.116 (Mon, 06 Oct 2008 16:58:01 UTC)
NNTP-Posting-Date: Mon, 06 Oct 2008 16:58:01 UTC
Date: Mon, 06 Oct 2008 11:58:30 -0500
Xref: news.mathworks.com comp.soft-sys.matlab:493862


Theodor Zouk wrote:

> So I will now have an array k=1x10 240 000 elements long.
> I want to get k(1:n),where n=4096, make some calculation and then store the result
> in the first row in an matrix..... then jump to k(n+1:2*n),calculated, 
> tore the result in the second row in the matrix and then jump to k(2*n+1:3*n) and so on...
>  Can this be vectorized? I have tried... but i dont think u can avoid an for loop here...

mat2cell() can break it up into cells of the appropriate size; then you can
use cellfun() (but cellfun is not always faster than a for loop.)