vector Shift
329 ビュー (過去 30 日間)
表示 古いコメント
Hello guys, it there any direct command to shift vector cells for example A=[1 2 3 4 5] to be A=[0 0 1 2 3] what I am doing now is B = circshift(A,[1 2]); B[1:2]= zeros Any Comments ?
0 件のコメント
回答 (1 件)
Paulo Silva
2011 年 9 月 12 日
A=[1 2 3 4 5]
B=zeros(size(A));
n=2; %Shift units
B(n+1:end)=A(1:end-n)
2 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!