Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: sorting data
Date: Mon, 14 Apr 2008 08:37:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 44
Message-ID: <ftv53e$a32$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 1208162222 10338 172.30.248.38 (14 Apr 2008 08:37:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 14 Apr 2008 08:37:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1265323
Xref: news.mathworks.com comp.soft-sys.matlab:462792



Could someone guide me through the following data sorting 
issue please? FYI please: I&#8217;ve attached something that 
I&#8217;ve tried (based on posts in math works forum) below. 
Thanks in advance!

My data is this:

2000	0
2006	1
2004	1
2000	1
2006	0
2006	0
2004	1

%column 1 independent variable, column 2 yes/no, yes=1 
(ie, correct) & no=0 (ie, incorrect)

My aim is to get the following:

2000	1	2
2004	2	2
2006	1	3

%first column = tested independent variables, 2nd 
column=no of correct responses & 3rd column=total number 
of testing at each independent variable.
-----------------------------------------------------
My script so far:

a=[
2000    0
2006    1
2004    1
2000    1
2006    0
2006    0
2004    1
] %data
 
b=sortrows(a) %sorts in ascending row
 
c=unique(b(:,1))%gives me a column of independent 
variables (I am stuck here)