Path: news.mathworks.com!not-for-mail 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$1@fred.mathworks.com> References: <gktk1p$7ak$1@fred.mathworks.com> Reply-To: <HIDDEN> NNTP-Posting-Host: webapp-03-blr.mathworks.com Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Trace: fred.mathworks.com 1232294221 14476 172.30.248.38 (18 Jan 2009 15:57:01 GMT) X-Complaints-To: news@mathworks.com NNTP-Posting-Date: Sun, 18 Jan 2009 15:57:01 +0000 (UTC) X-Newsreader: MATLAB Central Newsreader 870065 Xref: news.mathworks.com comp.soft-sys.matlab:512309 "Jens Doe" <jerald29@hotmail.com> wrote in message <gktk1p$7ak$1@fred.mathworks.com>... > 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 hth Jos