Path: news.mathworks.com!not-for-mail
From: "Bruno Luong" <b.luong@fogale.findmycountry>
Newsgroups: comp.soft-sys.matlab
Subject: Re: filtering data problem
Date: Fri, 24 Apr 2009 06:40:22 +0000 (UTC)
Organization: FOGALE nanotech
Lines: 24
Message-ID: <gsrmsm$5pv$1@fred.mathworks.com>
References: <gsoc01$eog$1@fred.mathworks.com> <gsp1tf$bno$1@fred.mathworks.com> <gsp87p$cdu$1@fred.mathworks.com>
Reply-To: "Bruno Luong" <b.luong@fogale.findmycountry>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1240555222 5951 172.30.248.37 (24 Apr 2009 06:40:22 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 24 Apr 2009 06:40:22 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 390839
Xref: news.mathworks.com comp.soft-sys.matlab:535122


"Pekka Kumpulainen" <pekka.nospam.kumpulainen@tut.please.fi> wrote in message <gsp87p$cdu$1@fred.mathworks.com>...
> "Jos " <#10584@fileexchange.com> wrote in message <gsp1tf$bno$1@fred.mathworks.com>...

> 
> Does enybody know what really happens in this kind of loop?
> Each time when  an element is removed (assigned to empty), does MATLAB have to find a new contiguous memory block for the new slightly smaller array? Thus fragmenting memory. 

Yes it does (Using my own PrintPtr mex command to track data pointer):

>> a=[1:10]
a =
     1     2     3     4     5     6     7     8     9    10

>> PrintPtr(a)
Ptr=0E23B720x
 
>> a(1)=[]
a =
     2     3     4     5     6     7     8     9    10

>> PrintPtr(a)
Ptr=0E3F1790x % <- it changes

Bruno