Path: news.mathworks.com!not-for-mail
From: "Steven Lord" <slord@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Memory limit workaround
Date: Tue, 10 Feb 2009 16:50:41 -0500
Organization: The MathWorks, Inc.
Lines: 34
Message-ID: <gmssrh$fpv$1@fred.mathworks.com>
References: <gmn8u4$dks$1@fred.mathworks.com>
Reply-To: "Steven Lord" <slord@mathworks.com>
NNTP-Posting-Host: lords.dhcp.mathworks.com
X-Trace: fred.mathworks.com 1234302641 16191 144.212.105.187 (10 Feb 2009 21:50:41 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 10 Feb 2009 21:50:41 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
X-RFC2646: Format=Flowed; Original
Xref: news.mathworks.com comp.soft-sys.matlab:517457



"Thiago " <thiago@mathworks.com> wrote in message 
news:gmn8u4$dks$1@fred.mathworks.com...
>I have a 3GHz pentium 4 with 1GB of RAM and 1524MB of virtual memory. Even 
>with this modest system, I am able to compose a 1x61276 character array in 
>MATLAB. This array has 3 variables in combination with a variety of complex 
>numbers cast into string-form. If I run eval( arg ), where arg is this huge 
>array, I am supposed to obtain a 2x1 symbolic matrix. However, I get the 
>following error message:

*snip*

> PS: I posted the 1x61276 character array here: 
> http://people.rit.edu/tsj9205/

Rather than performing the explicit multiplication to extract the first 
column of the matrix, why not just create the matrix using the first 61269 
characters (removing the "* [1;0]") and index into it to extract the first 
column.  That's all that multiplication is doing, and that's where you're 
running out of memory.

Alternately, if you don't need one or all of the variables to be symbolic 
(i.e. you know values for those variables ahead of time) assign values to 
those variables and then evaluate your string.  Performing the calculations 
numerically will be MUCH quicker and will avoid using so much memory.  [If 
you're trying to create the matrix symbolically so you can later substitute 
values in repeatedly, instead assign values to those variables repeatedly 
and evaluate the expression numerically.]

-- 
Steve Lord
slord@mathworks.com