) 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

1 vue (au cours des 30 derniers jours)
Plz help!!
  4 commentaires

Connectez-vous pour commenter.

Réponse acceptée

KALYAN ACHARJYA
KALYAN ACHARJYA le 20 Sep 2018
Modifié(e) : KALYAN ACHARJYA le 20 Sep 2018
% 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

Plus de réponses (0)

Catégories

En savoir plus sur Startup and Shutdown dans Help Center et File Exchange

Tags

Produits


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by