error in solving cell array multiplication
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
summyia qamar
le 13 Jan 2017
Modifié(e) : James Tursa
le 13 Jan 2017
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 6x7 double.. I want to multiply row(1) of 6x7 double with A(1), row(2) with A(2)and so on.
2 commentaires
Adam
le 13 Jan 2017
So what exactly is the structure of your cell array? You seem to have a single cell with a 6x7 double matrix in it from what you are saying. Or do you have many cells of size 6x7?
If your data in your cell array is regular and all the same size then you would be far better off using a 3d array instead.
Réponse acceptée
James Tursa
le 13 Jan 2017
Modifié(e) : James Tursa
le 13 Jan 2017
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.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Matrix Indexing dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!