) Write a function centervalue(M) that returns the value of the central element of matrix M. You may assume that M has an odd number of rows and columns. Have centervalue call your function halfway. >> centervalue(magic(5)) ans = 13

2 次查看(过去 30 天)
Plz help!!
  4 个评论

请先登录,再进行评论。

采纳的回答

KALYAN ACHARJYA
KALYAN ACHARJYA 2018-9-20
编辑:KALYAN ACHARJYA 2018-9-20
% Please note center value for odd square matrics only % Following code for all square and non-square also
function centre_value=centervalue(M)
[rows colm]=size(M);
center_value=M(round(rows/2),round(colm/2));
end

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

标签

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by