multiplying row vector by a scalar
25 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
trying to multiply the third row of a matrix by another row, B:
A = data(3, ;).*B
where B is a row vector
Need help finding a way to multiply the 3rd row of my matrix by a scalar value, for example 100.
Is there a way to do this all in one line?
Thanks!
0 commentaires
Réponses (4)
the cyclist
le 23 Fév 2023
You needed a colon in place of that semicolon
A = data(3,:).*B
3 commentaires
the cyclist
le 23 Fév 2023
% Your matrix
M = magic(4)
% Your scalar
scalar = 100;
% Multiply the third row of your matrix by your scalar
M(3,:) = scalar .* M(3,:)
0 commentaires
Voir également
Catégories
En savoir plus sur Logical dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!