From: Joseph <aggieinmissouri_DUDE@hotmail.com>
Path: news.mathworks.com!newsfeed-00.mathworks.com!webcrossing
Newsgroups: comp.soft-sys.matlab
Subject: Re: decrease in speed due to appending a row vecto
Message-ID: <ef580c1.0@webcrossing.raydaftYaTP>
Date: Thu, 24 May 2007 20:17:29 -0400
References: <ef580c1.-1@webcrossing.raydaftYaTP>
Lines: 14
NNTP-Posting-Host: 70.243.253.18
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
Xref: news.mathworks.com comp.soft-sys.matlab:410966



pre-allocate the space for your vector

help zeros

 Brian wrote:
>
>
> I have a row vector and I am adding new data elements in between at
> different locations. The approach i take is copy the vector in a
> temporary variable, add the new element at the desired location and
> then append the remaining elements from the temporary variable. I
> believed it should be very fast in Matlab but if i repeat it 15000
> times it takes me 10 seconds which is very slow for my application.
> Is there any other way to get around this problem.