create a matrix with existing matrix
이전 댓글 표시
i have a matrix with dimension
A = M * 361
i wanted to create a matrix with size
B = M * 3600
with this matrix A
how to do it??
also a matrix with dimension
C = N * 900
i wanted to create a matrix with size
D = N * 3600
how to do it?? please do reply...
with this matrix A
댓글 수: 4
ES
2013년 12월 3일
say M is 10, then A has 361*10=3610 elements. and B has 3600*10=36000 elements. B has about 32000 extra spots. what do you want to but in the extra spots. If you want to pad them with zeros, use
zeros,
if you want to make B as a 'collage' of A, use
repmat.
Elysi Cochin
2013년 12월 3일
ES
2013년 12월 3일
C to D is straightforward since number of rows in C and D are equal, and D has 4 times the columns in C.
D=repmat(C,1,4)
and for A to B you can use this workaround.
B=repmat(A,1,10)
B=B(:,1:3600);
I hope someone gives a straighter solution.
채택된 답변
추가 답변 (1개)
Andrei Bobrov
2013년 12월 3일
편집: Andrei Bobrov
2013년 12월 3일
One way:
newsize2 = 3600;
[i0,j0] = ndgrid(1:size(A,1),1:size(A,2));
F = griddedInterpolant(i0,j0);
[io,jo] = ndgrid(i0(:,1),linspace(1,j0(end),newsize2));
B = F(io,jo);
or
B = zeros(M,3600);
B = A(:,rem((1:size(B,2))-1,size(A,2))+1);
카테고리
도움말 센터 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!