How to copy columns in a matrix.

3 次查看(过去 30 天)
Suppose I have a matrix of 13*13 and I would like to copy column 1 of this matrix to column 2 of the same matrix , how can I carry out this copying operation?
Thank you in advance.

回答(1 个)

Bhaskar R
Bhaskar R 2020-2-16
编辑:Bhaskar R 2020-2-16
1)
res = circshift(mat, [0 -1]); % mat assumed as your matrix
2)
mat = [zeros(size(mat, 1),1), mat] % Append zeros as first column,
  1 个评论
sreesoumya cheppalli
Thank you for the answer, but I would like to copy the elements of first column to the second without any changes in the first column (both the columns belong to same matrix) . I don't want to create a new matrix.

请先登录,再进行评论。

类别

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