This is a great function that I am looking for.
However, it would be more perfect if
1. the array can be unsorted.
2. the indices can be returned
For example, [s,i] = SplitVec([1 2 1 3 2 1])
where
s={[1 1 1],[2,2],[3]}
i={[1 3 6],[2,5],[4]}
I do not know if it is possible
5
10 Jun 2014
Consecutive vector spliter
Partition an input vector into smaller series of subvectors of consecutive elements
OK ... I add the 'decrease' and 'increase' functions by:
case {'increase'}
fun = @(v) diff(v(:,1))<0;
case {'decrease'}
fun = @(v) diff(v(:,1))>0;
But, how to add functions for 'positive' and 'negative' values vector spliting?
Comment only
09 Jun 2014
Consecutive vector spliter
Partition an input vector into smaller series of subvectors of consecutive elements
Will be possible to generalize this function to split vector on monotonical parts using ismonotinic function (http://www.mathworks.com/matlabcentral/fileexchange/11637-ismonotonic)?
Comment only