how to find maximum alement

1 次查看(过去 30 天)
aya qassim
aya qassim 2018-12-25
评论: aya qassim 2018-12-25
There is a matrix (nXm )
we should write a code that gives the maximum element in the matrix.
it is eligible to use : sort, max, min , for, if ,while or any loops .
  1 个评论
aya qassim
aya qassim 2018-12-25
I have started the solution but did not know how to continue
any help...
a=size(M);
b=M(1:end);
c=repmat(a,length(a),1);
d=repmat(a',1,length(a));
e=(c-d);
f=M(e>=0);
h=(sum(f));

请先登录,再进行评论。

回答(1 个)

madhan ravi
madhan ravi 2018-12-25
  7 个评论
aya qassim
aya qassim 2018-12-25
it is a homework but I do not have any idea how to start the solution, I have tried some ways but they did not work.
aya qassim
aya qassim 2018-12-25
编辑:aya qassim 2018-12-25
I have started the solution in this way, can you help me to continue..
M= is the matrix that we put.
a=size(M);
b=M(1:end);
c=repmat(a,length(a),1);
d=repmat(a',1,length(a));
e=(c-d);
f=(e>=0);
h=sum(f);

请先登录,再进行评论。

类别

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