Converting Vector to matrix.
이전 댓글 표시
Hello!
I want to convert vector:
V = [1 2 3 4 5 6 7 8 9]
To
V1 = [
1 2 3 4 5
2 3 4 5 6
3 4 5 6 7
4 5 6 7 8
5 6 7 8 9 ]
Is there a Matlab command that will let me do this? or this needs to be coded?
Thanks
KIB
채택된 답변
추가 답변 (2개)
James Tursa
2011년 8월 6일
Also not sure how general you want the method to be, but here is another way for your particular example:
n = ceil(numel(V)/2);
V1 = bsxfun(@plus,1:n,(0:n-1)');
카테고리
도움말 센터 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!