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$>
References: <gn20qd$2ic$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: 1234471561 10072 (12 Feb 2009 20:46:01 GMT)
NNTP-Posting-Date: Thu, 12 Feb 2009 20:46:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1381374
Xref: comp.soft-sys.matlab:517954

"Diego Zegarra" <> wrote in message <gn20qd$2ic$>...
> 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.