MATLAB: How to use unique function to get data only when the number in one row increases

data importfunction

Hello,
I am trying to figure out on how to extract data only when the number in one of the row increases; for example:
a = [1;1;1; 2;3;4;5;6;7;8;9;10;10;10;11;11];
b = rand(16,1);
c = [b,a]
1) i want to extract the b data only when the number in 'a' increases, which are 1, 2, 3, 4, 5, – 10 without taking the data when the number in a is the same.
2) The numbers in a will go back to 1 after it reaches 255, so i want the function to still take the data when the number goes back to 1. this means that only when the number in a are the same in consequtive order then only you remove the repetition
i appreciate your help in this, please let me know if my question is not clear.

Best Answer

>> [a [true;diff(a)>0]]
ans =
1 1
1 0
1 0
2 1
3 1
4 1
5 1
6 1
7 1
8 1
9 1
10 1
10 0
10 0
11 1
11 0
>>
The "startover" case depends somewhat on how the series is defined; in the simplest case I think it would simply be
>> a=[a;a(1:5)]; % sample dataset w/ reset...
>> [a [true;diff(a)~=0]].'
ans =
Columns 1 through 15
1 1 1 2 3 4 5 6 7 8 9 10 10 10 11
1 0 0 1 1 1 1 1 1 1 1 1 0 0 1
Columns 16 through 21
11 1 1 1 2 3
0 1 0 0 1 1
>>
Or,
>> find([true;diff(a)~=0]).'
ans =
1 4 5 6 7 8 9 10 11 12 15 17 20 21
>>