Path: news.mathworks.com!newsfeed-00.mathworks.com!panix!bloom-beacon.mit.edu!newsswitch.lcs.mit.edu!newsfeed.cwix.com!dc3peer2.nntp.savvis.net!peer.nntp.savvis.net!bigfeed.bellsouth.net!news.bellsouth.net!cyclone1.gnilink.net!gnilink.net!nx02.iad.newshosting.com!newshosting.com!69.16.185.11.MISMATCH!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post02.iad.highwinds-media.com!newsfe05.iad.POSTED!7564ea0f!not-for-mail
From: Walter Roberson <roberson@hushmail.com>
Organization: Canada Eat The Cookie Foundation
User-Agent: Thunderbird 2.0.0.18 (Windows/20081105)
MIME-Version: 1.0
Newsgroups: comp.soft-sys.matlab
Subject: Re: Number of changes in a value
References: <ghmadq$egh$1@fred.mathworks.com>
In-Reply-To: <ghmadq$egh$1@fred.mathworks.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 18
Message-ID: <9ly%k.771$Ir1.265@newsfe05.iad>
NNTP-Posting-Host: 24.79.146.116
X-Complaints-To: internet.abuse@sjrb.ca
X-Trace: newsfe05.iad 1228845509 24.79.146.116 (Tue, 09 Dec 2008 17:58:29 UTC)
NNTP-Posting-Date: Tue, 09 Dec 2008 17:58:29 UTC
Date: Tue, 09 Dec 2008 11:58:41 -0600
Xref: news.mathworks.com comp.soft-sys.matlab:505895


anoop Sivasankaran wrote:
> 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.

> 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

graycomatrix(TheVector,'NumLevels',4,'GrayLimits',[1 4])

Note: this function might be part of the image processing toolbox

-- 
.signature note: I am now avoiding replying to unclear or ambiguous postings.
Please review questions before posting them. Be specific. Use examples of what you mean,
of what you don't mean. Specify boundary conditions, and data classes and value
relationships -- what if we scrambled your data or used -Inf, NaN, or complex(rand,rand)?