Filter löschen
Filter löschen

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

8 Ansichten (letzte 30 Tage)
Bashir Yusuf Bichi
Bashir Yusuf Bichi am 6 Nov. 2017
Beantwortet: KL am 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]

Akzeptierte Antwort

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

Weitere Antworten (0)

Kategorien

Mehr zu Multidimensional Arrays finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by