) 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 visualizzazione (ultimi 30 giorni)
Plz help!!
  4 Commenti

Accedi per commentare.

Risposta accettata

KALYAN ACHARJYA
KALYAN ACHARJYA il 20 Set 2018
Modificato: KALYAN ACHARJYA il 20 Set 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

Più risposte (0)

Categorie

Scopri di più su Startup and Shutdown in Help Center e File Exchange

Tag

Prodotti


Release

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by