From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Converting Matrix Dimensions?
Date: Sun, 18 Jan 2009 15:57:01 +0000 (UTC)
Organization: Erasmus MC
Lines: 12
Message-ID: <gkvjgd$e4c$>
References: <gktk1p$7ak$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: 1232294221 14476 (18 Jan 2009 15:57:01 GMT)
NNTP-Posting-Date: Sun, 18 Jan 2009 15:57:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 870065
Xref: comp.soft-sys.matlab:512309

"Jens Doe" <> wrote in message <gktk1p$7ak$>...
> I have a problem in my class and the data is given in a 20x4 data file. It asks to find the mean, median and other things. However we're not allowed to use the mean function to find the mean. I have an idea that by converting the matrix into a 1x80 and then adding the sum and dividing by 80, I'll get the answer. But how do you convert the matrix from 20x4 to 1x80? Thanks

In general, the function RESHAPE is designed to, well, reshape an array. If you want to end up with a vector (N-by-1 or 1-by-N shapes) use reshape with an empty argument, or you can use the colon operation (followed by a transpose)
Example: reshape(A,[],1) will reshape an array A into a column vector