1.matlab cirshiftԴ?源码蚁从旅游源码?
2.解ç MATLAB循ç¯ç§»ä½
matlab cirshiftԴ??
function y = shaixuan(a,b)
A = [1:a]';
i = 1;
while length(A)>=1
A = circshift(A,-(b-1));%采用循环移位的方式
y(i) = A(1);
A(1) = [];
i = i+1;
end
>> y = shaixuan(,7)
y =
Columns 1 through
7 1 9 5 4 8
Columns through
6 2 3
解ç MATLAB循ç¯ç§»ä½
å¯ä»¥ç´æ¥ä½¿ç¨MATLABèªå¸¦çå½æ°circshift:
circshift(a,[0,-3])
å®çæææ¯å°açè¡ä¸æ¢,açå3åç½®å
a=1:;b=circshift(a,[0,-3])
b =
4 5 6 7 8 9 1 2 3