Path: news.mathworks.com!not-for-mail
From: "Joe Tomaino" <JLTomaino@aol.com>
Newsgroups: comp.soft-sys.matlab
Subject: Need to Sort Data
Date: Fri, 1 Oct 2010 23:51:05 +0000 (UTC)
Organization: Oregon State
Lines: 20
Message-ID: <i85s59$2ke$1@fred.mathworks.com>
Reply-To: "Joe Tomaino" <JLTomaino@aol.com>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1285977065 2702 172.30.248.35 (1 Oct 2010 23:51:05 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 1 Oct 2010 23:51:05 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2149913
Xref: news.mathworks.com comp.soft-sys.matlab:675176

Hello, 

I'm trying to sort some simple data and I'm having a tough time finding a reasonably elegant solution. My data is composed of two columns, X and Y. Some of the values of X are repeated, and when that's the case, I want my program to average the corresponding values of Y.

For example, if my data were:

1 1
1 2
2 3
3 4

I'd want it to return:

1 1.5
2 3
3 4

Any help would be great. Thanks

-Joe