Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!x31g2000prc.googlegroups.com!not-for-mail
From: Nathan <ngreco32@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Divide, operate and reassemble matrix
Date: Thu, 18 Jun 2009 14:54:43 -0700 (PDT)
Organization: http://groups.google.com
Lines: 63
Message-ID: <092599c9-0913-410c-8f88-cc3911772334@x31g2000prc.googlegroups.com>
References: <h1eb7l$531$1@fred.mathworks.com> <728fb21e-1182-4780-b27d-44a4d369d85f@o21g2000prn.googlegroups.com> 
	<h1ec9d$d16$1@fred.mathworks.com>
NNTP-Posting-Host: 198.206.219.33
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1245362084 8722 127.0.0.1 (18 Jun 2009 21:54:44 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Thu, 18 Jun 2009 21:54:44 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: x31g2000prc.googlegroups.com; posting-host=198.206.219.33; 
	posting-account=_KeVcAoAAAB7j3xn35ujaQ0BoQhuzwJP
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.11) 
	Gecko/2009060215 Firefox/3.0.11,gzip(gfe),gzip(gfe)
X-HTTP-Via: 1.1 wwwproxy-son-ca-01.ca.sandia.gov:80 (squid/2.5.STABLE14)
Xref: news.mathworks.com comp.soft-sys.matlab:548776


On Jun 18, 2:41 pm, "Diego Lass" <dlISC...@gmail.com> wrote:
> Oh, because when I run whatever I wrote, I got the following error
>
> ??? Error using ==> minus
> Maximum variable size allowed by the program is exceeded.
>
> Error in ==> [some program] at 18
>    [equation involves matrix .*, ./ and (1 - some matrix .^)]
>
> However, when I tested on a smaller matrix, the code works
> So I was thinking maybe if I divide the matrix into submatrices, do the thing and reassemble them, the code might work.
>
> Thanks
> Diego  
>
> Nathan <ngrec...@gmail.com> wrote in message <728fb21e-1182-4780-b27d-44a4d369d...@o21g2000prn.googlegroups.com>...
> > On Jun 18, 2:23?pm, "Diego Lass" <dlISC...@gmail.com> wrote:
> > > Hi
> > > I have a problem with a large matrix, what I want to do is to divide the matrix into 4 submatrices, do some operation then reassemble the submatrix together. A toy example
>
> > > A = [1 2 3 ; 3 4 5 ; 2 3 4; 5 1 2 ]
> > > A =
>
> > > ? ? ?1 2 3
> > > ? ? ?3 4 5
> > > ? ? ?2 3 4
> > > ? ? ?5 1 2
> > > ?I want to divide A into ANY 4 approximately equal sized partitions, for example
> > > 1 2
> > > 3 4
>
> > > 3
> > > 5
>
> > > 2 3
> > > 5 1
>
> > > 4
> > > 2
>
> > > then do some operation, say add 2 to each element. Then reassemble them together, to get
>
> > > ? ? ?3 4 5
> > > ? ? ?5 6 7
> > > ? ? ?4 5 6
> > > ? ? ?7 3 4
> > > What is the most efficient way of doing this?
> > > Thanks
> > > Diego
>
> > You just posted this not an hour ago with a different title... Why?
>
> > Why disassemble and do operations when you can just do that operation
> > to each element in one instruction?

Are you using bsxfun?
If not, check that out. It might be what you're looking for.