how to replace values in matrix across entire row

1 view (last 30 days)
I want to replace current values in a particular row of matrix with different values for each index in that particular row

Accepted Answer

Walter Roberson
Walter Roberson on 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

More Answers (0)

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!