change column in matrix
조회 수: 3 (최근 30일)
이전 댓글 표시
Hi!
is it possible in matlab to change coluns:
A=[a1 a2 a3 a4.......a2250],a1...a2250 are arrays oth size(30*1).
i want to get this matrix B=[a1 a75 a150.... a2 a76....a3 a77..... ].
that means i have a step of 74
i wish you could help thank you
댓글 수: 1
Muruganandham Subramanian
2012년 12월 7일
편집: Muruganandham Subramanian
2012년 12월 7일
if you step size is 74..the matrix will be B=[a1 a75 a149 a223...] like this only.. check is your question is right?
답변 (2개)
Andrei Bobrov
2012년 12월 7일
편집: Andrei Bobrov
2012년 12월 7일
B = reshape(permute(reshape(A,size(A,1),75,[]),[1 3 2]),size(A,1),[]);
or
s = size(A,2);
B = A(:,bsxfun(@plus,1:75:s,(0:(s/75-1))')');
or
B = A(:,reshepe(1:size(A,2),75,[])');
댓글 수: 0
Muruganandham Subramanian
2012년 12월 7일
편집: Muruganandham Subramanian
2012년 12월 7일
a=1:2250;
d=reshape(a,[75 30]);
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!