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

9 visualizzazioni (ultimi 30 giorni)
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]

Risposta accettata

KL
KL il 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?

Più risposte (0)

Categorie

Scopri di più su Get Started with MATLAB in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by