Hi folks, i’m new here and don’t know doing the right to ask / propose a feature of cellfun / arrayfun.
The last times while programming in octave i would have a great benefit, if i would have access to the act index in cellfun / arrayfun:
cellfun(@(x,y) ones(1,1:numel(x)*y, cell,‘uniformoutput’,false).
I have search the web of this feature, but don’t get any info at all.
It would be nice, if the ‘y’ was holding the actual index, like [1,2,1] or similar.
My workaround for one-dimensional cells is like that:
out=cellfun(@(x) ones(1:numel(x))*persitentIdx, cell, ‘uniformoutput’, false),
were the persitentIdx is a function like that:
… persitent pIdx=0;
… if start
… … pIdx=0
… … pIdx+=1;
So i think, it would be nice to have access to the actual index. I don’t like loops, so i tend to this workaround. Maxbe, there exists another solution for that what want do.
If my post isn’t on the right place, i’m sorry about. Hope, my question/suggestion is clear.
I’m wondering, that index isn’t accessible within the cellfun. Otherwise i’m sure, it gives a reason vor that.
ps: Is there a code - editor anyway?