how to circularly shift the entire elements of a matrix

1 次查看(过去 30 天)
i need to shift the elements by one position if the input is
a=[1 2 3;4 5 6;7 8 9]
the output i needed is
b=[9 1 2;3 4 5;6 7 8]
pls send me the code

回答(1 个)

Stephen23
Stephen23 2018-3-21
>> b = a.';
>> b(:) = b([end,1:end-1]);
>> c = b.'
c =
9 1 2
3 4 5
6 7 8

类别

Help CenterFile Exchange 中查找有关 Spline Postprocessing 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by