Before I was using the following, but I didnt have the third condition in B when b is equal to zero...
A = [1.2;1.3;1.4;1.5;1.6;1.7;1.8;1.9;1.1;1.11;1.12;1.13;1.14];
B = [1;1;1;2;2;2;2;2;2;1;1;1;1];
X = cumsum([true;0~=diff(B)])
C = accumarray(X,A,[],@(v){v});
C{:}
ans =
1.2000
1.3000
1.4000
ans =
1.5000
1.6000
1.7000
1.8000
1.9000
1.1000
ans =
1.1100
1.1200
1.1300
1.1400