I am expanding the arrayfun code of the thread To Find Double Sequence With Transforms in Matlab? for a list of vectors in cellfun (DD).
Pseudocode
DD = {[9 1 5 6 6 6 5 1 1 0 7 7 7 7 7 8], [1 1 1 4], [7 7 7]};
d = cellfun(@(i) diff(diff([0 i 0]) == 0), DD, 'Uniform', false);
y = cellfun(@(z) ...
arrayfun(@(i,j) DD{i}(i:j), find(z>0), find(z<0), 'Uniform', false), ...
d, 'Uniform', false););
Expected output
y = { {[6 6 6], [1 1], [7 7 7]}, ...
{[1 1 1]}, ...
{[7 7 7]} };
Error
Index exceeds matrix dimensions.
Error in findDoubleSequenceAnonFunction>@(i,j)DD{i}(i:j)
Error in
findDoubleSequenceAnonFunction>@(z)arrayfun(@(i,j)DD{i}(i:j),find(z>0),find(z<0),'Uniform',false)
Error in findDoubleSequenceAnonFunction (line 5)
y = cellfun(@(z) ...
Comments
d = cellfun(.... I am applying the functiondiff(diff(...incellfun. It should be ok.y = cellfun(.... Need to havecellfunhere because have the again a cell of vectors ind. Somehow, the cellfun-arrayfun is complicating.
How can you have cellfun-arrayfun combination here?
arrayfun? Your anonymous function only expects 2. Seems like yourdis in the wrong spot - Suever