Is there any way to retrieve the index of the element on which a function called by cellfun, arrayfun or spfun acts? (i.e
cellfun
arrayfun
spfun
It's simple. Just make a cell like: C = num2cell(1:length(S)); then: out=arrayfun(@(x,c) c*x,S,C)