concatenation of matrix and final value

1 vue (au cours des 30 derniers jours)
summyia qamar
summyia qamar le 16 Déc 2016
Commenté : summyia qamar le 16 Déc 2016
%%minimize intercellular movements
part_machine=
[1 0 0 1 0 1 1; 0 1 1 1 0 0 1; 1 0 0 1 1 0 0; 1 0 0 0 1 0 1; 1 1 0 0 0 1 0; 0 1 0 0 0 1 1]
demand=[600;550;620;500;590;600]; numIterations=100;
movement_cost=zeros(numIterations,1)
for k=1:numIterations
rand_cell_assigntomachines=randi([0,1],7,3);
Part_cell=part_machine*rand_cell_assigntomachines;
Part_cell(Part_cell>=1)=1;
no_of_movements=sum(Part_cell,2)-1;
movement_cost=sum(bsxfun(@times,no_of_movements,demand))
end
minval=min(movement_cost)
I want to get the answer of min movement_cost along with the associated rand_cell_assigntomachines matrix from which thi answer is generated..is there any way? because rand_cell_assigntomachines ia a matrix of 7x3 while movement cost is just one value.

Réponse acceptée

KSSV
KSSV le 16 Déc 2016
Is this okay?
minval=min(movement_cost)
[rand_cell_assigntomachines minval(ones(7,1))]
  1 commentaire
summyia qamar
summyia qamar le 16 Déc 2016
yes God bless you.thanks

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements 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!

Translated by