필터 지우기
필터 지우기

How can we do it bu function call?

조회 수: 2 (최근 30일)
Aimen Mujahid
Aimen Mujahid 2017년 2월 23일
댓글: Jan 2017년 2월 23일
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
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개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by