MATLAB: Error in solving cell array multiplication

MATLABrow wise array multiplication

how can I do the column multiplication of each cell array with a vector? I have a A= 2 4 2 4 2 3 and a cell array cell with 6×7 double.. I want to multiply row(1) of 6×7 double with A(1), row(2) with A(2)and so on.

Best Answer

result = cellfun(@(X)bsxfun(@times,Daily_demand(:),X),all_comb_of_routes,'uni',false);
btw, you can replace this code:
for n=1:6
Daily_demand(n)=Demand(n)/demand_period;
end
with simply this:
Daily_demand = Demand / demand_period;
And what is the point of the "for n=1:No_of_Parts" loop? You are using the same variable n here which is used for the outer loop. I don't think you really want to do that.