How can i find the center value of a matrix NxN, where N is odd number. After that, how can i change that number for another number

 Réponse acceptée

David Hill
David Hill le 26 Avr 2020

2 votes

a=(size(yourMatrix)+1)/2;
yourMatrix(a(1),a(2))=newNumber;

Plus de réponses (1)

Tommy
Tommy le 26 Avr 2020

1 vote

centerValue = A((N*N+1)/2);
A((N*N+1)/2) = newValue;

Catégories

En savoir plus sur Aerospace Blockset dans Centre d'aide et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by