How can I multiply only the first column of a matrix by a scalar

4 次查看(过去 30 天)
I have a matrix with two columns and I need to multiply only the first column by a scalar. It is the first time I use Matlab so I have no idea how to do so.
Thanks!

回答(1 个)

Rene Riha
Rene Riha 2018-3-17
A(:, 1)=k.*A(:, 1)
  1 个评论
alvaro felipe
alvaro felipe 2018-3-17
Thank you Rene. With this code, the output is the first column of the matrix multiplied by the scalar.
Is there any way to have the original matrix (2 columns) with only the first matrix multiplied by the scalar?
Thanks again

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Multidimensional Arrays 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by