Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: How to find if a sequence occurs?
Date: Thu, 12 Feb 2009 20:46:01 +0000 (UTC)
Organization: MIT Lincoln Laboratories
Lines: 10
Message-ID: <gn21q9$9qo$1@fred.mathworks.com>
References: <gn20qd$2ic$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1234471561 10072 172.30.248.37 (12 Feb 2009 20:46:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 12 Feb 2009 20:46:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1381374
Xref: news.mathworks.com comp.soft-sys.matlab:517954

"Diego Zegarra" <diegozbb@gmail.com> wrote in message <gn20qd$2ic$1@fred.mathworks.com>...
> Suppose we have the vector a=[2 4 5 3 7 6] and I want to see if the 4 is after the 2 and so on for every number, 6 after 7, etc.
> 
> Anyone can guide me on a way to do this? Thanks so much in advance!

If you mean that you want to check if the vector is strictly increasing, you can use:

strictly_increasing = all(diff(a) > 0);

If all of the numbers in the vector are increasing, (no duplicates, no decreasing), strictly_increasing will be logical 1. Otherwise, it will be logical 0.