Which is the simplest way to create neighbourhood pairs?

답변 (2개)

Radha Krishna Maddukuri
Radha Krishna Maddukuri 2015년 4월 24일
편집: Radha Krishna Maddukuri 2015년 4월 24일
I hope this helps.
B = zeros(numel(A)-1,2);
for i =1:1:(numel(A)-1)
B(i,:) = [A(i) A(i+1)];
end
Andrei Bobrov
Andrei Bobrov 2015년 4월 24일
편집: Andrei Bobrov 2015년 4월 24일
hankel(a(1:end-1),a(end-1:end))
or
[a(1:end-1)', a(1:end-1)'+1]
or
a1 = a(1:end-1)
bsxfun(@plus,a1(:),[0 1])

카테고리

도움말 센터File Exchange에서 Simulink에 대해 자세히 알아보기

질문:

2015년 4월 21일

편집:

2015년 4월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by