how to replace values in matrix across entire row

1 次查看(过去 30 天)
I want to replace current values in a particular row of matrix with different values for each index in that particular row

采纳的回答

Walter Roberson
Walter Roberson 2022-9-4
%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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by