Circular Shift Columns

版本 1.4.0.0 (1.9 KB) 作者: Stuart Layton
This function quickly and independently circularly shift each column of an input matrix
381.0 次下载
更新时间 2012/8/20

查看许可证

CIRCSHIFT_COLUMNS Circularly shift each column by a different amount

B = CIRCSHIFT_COLUMNS(A, SHIFT_VECTOR) circularly shifts the columns in A
by the values specified in the vector D. Negative elements of D shift columns up
and positive values shift columns down.

B = CIRCSHIFT_COLUMNS(A) generates random shift values bound
between 0 and the number of rows in A.

[B D] = CIRCSHIFT_COLUMNS(...) returns the vector of shift values

Example:
A = [ 1 1 1; 2 2 2; 3 3 3; 4 4 4];
B = circshift_columns(A, [0 1 -2]);
B = 1 4 3
2 1 4
3 2 1
4 3 2

引用格式

Stuart Layton (2024). Circular Shift Columns (https://www.mathworks.com/matlabcentral/fileexchange/37687-circular-shift-columns), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2012a
兼容任何版本
平台兼容性
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.4.0.0

Fixed spelling errors in the help documentation

1.1.0.0

fixed typo in summary

1.0.0.0