Path: news.mathworks.com!not-for-mail
From: "Sadik " <sadik.hava@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Converting Matrix Dimensions?
Date: Sun, 18 Jan 2009 01:00:04 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 10
Message-ID: <gktuuk$6oc$1@fred.mathworks.com>
References: <gktk1p$7ak$1@fred.mathworks.com>
Reply-To: "Sadik " <sadik.hava@gmail.com>
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 1232240404 6924 172.30.248.38 (18 Jan 2009 01:00:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 18 Jan 2009 01:00:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1666517
Xref: news.mathworks.com comp.soft-sys.matlab:512263


"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

Hello Jens,

Let us call your data matrix as dataMatrix. Then, the following will give the 1x80 version of your data:

dataMatrix(:).'

Please note the transpose opearation (.'). I wrote the apostrophe with a period in front in case your data is complex. However, if it is real, then dataMatrix(:)' gives the same result [that is, with only an apostrophe.].