How can we do it bu function call?

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 件のコメント

Walter Roberson
Walter Roberson 2017 年 2 月 23 日
What part is to be done as a function call? What are the expected inputs to the function? What are the expected outputs of the function?
Aimen Mujahid
Aimen Mujahid 2017 年 2 月 23 日
編集済み: Aimen Mujahid 2017 年 2 月 23 日
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 2017 年 2 月 23 日
I assume you want Cmd=zeros(M, D) instead of Cmd=zeros(M:D).

サインインしてコメントする。

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCreating and Concatenating Matrices についてさらに検索

質問済み:

2017 年 2 月 23 日

コメント済み:

Jan
2017 年 2 月 23 日

Community Treasure Hunt

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

Start Hunting!

Translated by