Effacer les filtres
Effacer les filtres

How can we do it bu function call?

3 vues (au cours des 30 derniers jours)
Aimen Mujahid
Aimen Mujahid le 23 Fév 2017
Commenté : Jan le 23 Fév 2017
M=input('Enter number of manufacturers');
D=input('Enter number of distributers');
O=1;
T=1;
R=1;
Z=1;
Cmd=zeros(M:D);
for m=1:M;
for d=1:D;
Cmd(m,d)=input('Enter traveling cost for manufacturer to distributer');
disp(Cmd);
end
end
SumCmd=sum(Cmd(:));
disp(SumCmd);
  3 commentaires
Aimen Mujahid
Aimen Mujahid le 23 Fév 2017
Modifié(e) : Aimen Mujahid le 23 Fév 2017
function for Cmd(m,d) number of M,D and cost of each element in tha matrix are inputs and Output should be the matrix of Cmd
Jan
Jan le 23 Fév 2017
I assume you want Cmd=zeros(M, D) instead of Cmd=zeros(M:D).

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by