matrix value propagation along the rows
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello,
A(1,1:7) vector and I want a mtrix where A is repeated in B matrix 19 rows B(1:19,1:7).
Matlab sims to have issues with B(1:19,:)=A, or B(1:19,1:7)=A.
So idea is A = [1 2 3 4 5 6 7]
and resulting
B = [
1 2 3 4 5 6 7
1 2 3 4 5 6 7
1 2 3 4 5 6 7
...
] (in 19 rows)
BR
Sanat
댓글 수: 0
채택된 답변
Bruno Luong
2023년 11월 5일
편집: Bruno Luong
2023년 11월 5일
Any of these should do
A = [1 2 3 4 5 6 7]
B(1:19,1:7)=repmat(A,19,1)
B(1:19,1:7)=repelem(A,19,1)
B(1:19,1:7)=A(ones(1,19),:)
for r=1:19
B(r,:) = A;
end
B
추가 답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!