Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Converting Matrix Dimensions?
Date: Mon, 19 Jan 2009 03:17:03 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 23
Message-ID: <gl0rbf$aun$1@fred.mathworks.com>
References: <gktk1p$7ak$1@fred.mathworks.com> <gkvjgd$e4c$1@fred.mathworks.com> <gl0hap$83m$1@fred.mathworks.com> <gl0ii5$ru9$1@fred.mathworks.com> <gl0kjp$crb$1@fred.mathworks.com> <gl0lc7$3ta$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1232335023 11223 172.30.248.35 (19 Jan 2009 03:17:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 19 Jan 2009 03:17:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1674909
Xref: news.mathworks.com comp.soft-sys.matlab:512375


"Matt Fig" <spamanon@yahoo.com> wrote in message <gl0lc7$3ta$1@fred.mathworks.com>...
> I assume you are using Matfiles which store Matlab variables.  If so then this should work.
> 
> filename=input('What data file would you like to load? ','s');
> load(filename);
> 
> clear filename
> who
> numbers = input('Which variable do you want to manupulate?')
> 
> 
> numbers(:).'  % The file name.
> allnumbers=numbers(:).'
> length(allnumbers)
> l=length(allnumbers)
> disp(['Length of data ' num2str(l)])
> sum(allnumbers)
> s=sum(allnumbers)
> mean=s/l
> disp(['Your mean is ' num2str(mean)])
> 

Thank you for posting this. It works. Im just wondering, what do lines 4-6 of the code mean? The line that starts with clear filename and ends with numbers=input('Which variable do you want to manipulate?'). Our teacher never explained what the clear function does, and I think the who command displays what variables are present.