Effacer les filtres
Effacer les filtres

how can I add a value to a particular cell in an array.

8 vues (au cours des 30 derniers jours)
Bashir Yusuf Bichi
Bashir Yusuf Bichi le 6 Nov 2017
Réponse apportée : KL le 6 Nov 2017
if [3,2,4,5;3,2,6,4;2,5,8,5] is array then we add we add 2 to the second row to become [2,3,2,5;3, 4,6,4;2,5,8,5]
  1 commentaire
Star Strider
Star Strider le 6 Nov 2017
Your examples do not match what you state you want to do.

Connectez-vous pour commenter.

Réponse acceptée

KL
KL le 6 Nov 2017
if A is your array,
>> A = [3,2,4,5;3,2,6,4;2,5,8,5]
A =
3 2 4 5
3 2 6 4
2 5 8 5
and if you want to add 2 to 2nd row, 2nd column,
A(2,2) = A(2,2)+2;
and then A becomes,
A =
3 2 4 5
3 4 6 4
2 5 8 5
is this what you mean?

Plus de réponses (0)

Catégories

En savoir plus sur Multidimensional Arrays dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by