how to replace values in matrix across entire row

1 Ansicht (letzte 30 Tage)
I want to replace current values in a particular row of matrix with different values for each index in that particular row

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 4 Sep. 2022
%example data
A = randi(9, 8, 4)
A = 8×4
9 3 8 5 2 9 3 9 6 9 8 9 8 6 3 1 7 2 2 1 7 8 8 1 5 2 8 9 4 8 7 9
%example row-based operations
A(3,:) = A(3,:).^2 - 2
A = 8×4
9 3 8 5 2 9 3 9 34 79 62 79 8 6 3 1 7 2 2 1 7 8 8 1 5 2 8 9 4 8 7 9
A(6, :) = randi([10 19], 1, 4)
A = 8×4
9 3 8 5 2 9 3 9 34 79 62 79 8 6 3 1 7 2 2 1 16 11 10 10 5 2 8 9 4 8 7 9

Weitere Antworten (0)

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Produkte


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by