how to replace values in matrix across entire row

9 vues (au cours des 30 derniers jours)
Kumaresan Karunanidhy
Kumaresan Karunanidhy le 4 Sep 2022
I want to replace current values in a particular row of matrix with different values for each index in that particular row

Réponse acceptée

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

Plus de réponses (0)

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Produits


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by