I wish to use cellfun similarly to how I would use bsxfun for applying a function on nx1 cell and 1x1 cell i.e for bsxfun,
multi = bsxfun(@times, rand(1,10), 2)
However, when doing something like this in cellfun it complains that the cells are not the same size. How can I resolve this?
To use for a Cell Example:
My actual problem is pretty simple and I can see some other ways around this but my initial instincts were to use cellfun. Not being able brought me here. Here is my actual problem,
use_var = {[0,1,0,1,1,1,1,0]}; rule_dep = {[1,3],[1,2,4],[3,5,7],[5],[4,8]};
I now wish to indexuse_var by each individual rule_dep. My first try was,
use_rule = cellfun(@(x,y) y{x}, rule_depend, use_var, 'Uniformoutput', false);
but throws up dimension problems.