How to rearrange matrix columns?
2 次查看(过去 30 天)
显示 更早的评论
I am having 7*7 matrix. Now i need to rearrange the matrix colums in such a way that last column of the matrix will be considered first column and first column as second, second column as third and so on.
Example:
A=[0 0 0 1 0 0 0
0 1 0 0 0 0 0
0 0 0 0 1 0 0
1 0 0 0 0 0 0
0 0 0 0 0 1 0
0 0 1 0 0 0 0
0 0 0 0 0 0 1]
Expected output:
Example:
B=[0 0 0 0 1 0 0
0 0 1 0 0 0 0
0 0 0 0 0 1 0
0 1 0 0 0 0 0
0 0 0 0 0 0 1
0 0 0 1 0 0 0
1 0 0 0 0 0 0]
0 个评论
采纳的回答
Arif Hoq
2023-1-25
A=[0 0 0 1 0 0 0
0 1 0 0 0 0 0
0 0 0 0 1 0 0
1 0 0 0 0 0 0
0 0 0 0 0 1 0
0 0 1 0 0 0 0
0 0 0 0 0 0 1];
B= circshift(A,1,2)
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!