Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Number of changes in a value
Date: Tue, 9 Dec 2008 17:38:02 +0000 (UTC)
Organization: Univ of Glasgow
Lines: 7
Message-ID: <ghmadq$egh$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1228844282 14865 172.30.248.35 (9 Dec 2008 17:38:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 9 Dec 2008 17:38:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1320421
Xref: news.mathworks.com comp.soft-sys.matlab:505889


An entry-level qestion.

I have a data file (1 x 5000000), which shows different states of my model during integration. I have four states and i have used 1, 2,3,4 to indicate each state. So the entire data file contain these 4 numbers. 

Now I need to find number of changes. i.e I need to find how many changes from 1 to 2, 1 to 3, 1 to 4, 2 to 1, 2 to 3 etc. 

Please let me know how to do this