Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.



Re: very large array
Posted:
Jun 24, 2013 12:27 PM


dpb <none@non.net> wrote in message <kq9r5n$21t$1@speranza.aioe.org>...
> Now you're not incrementing i so you'll process the same row over and > over and over... > > While doing it by a loop is _NOT_ the way for large cases, sometimes it > is handy and time isn't an issue for small array sizes. The way in > general to do such things is to start at the end and progress > forwardsthat way the lower indices aren't affected by the deleted rows... > > for i=length(dat):1:1 > if((sum(dati(i,:))<355) & range(dati(i,:))>20) > dati(i,:) = []; > end > end > > Now it won't run off the end (but it will still run a _loooong_ time, > methinks... > > See other comments on "why" and perhaps a morequicker way of breaking > it into chunks if you're causing memory paging w/ it in one full array > in (virtual) memory. >
Thanks for your answer :), I'm actually decreasing the variable i (certainly not in that piece of code that I posted for example excuse me for such example :)) ) Seems to me that in reality it takes a a lot to decrease the array, it seems that every time rebuilds the index or a sort of it.
Thanks a lot



