How to decompose and expand a vector into ones
조회 수: 2 (최근 30일)
이전 댓글 표시
채택된 답변
Adam Danz
2019년 8월 8일
편집: Adam Danz
2019년 8월 8일
" I = [2, 2]' How can I multiply that by 12 and get a 1x48 vector filled by ones ?"
My interpretation: you want to multiply (or add?) the elements in I and then you want to multiply that result by 12 to get 48. Then create a row vector of 1s with length 48. Is that right?
I = [2, 2]';
x = ones(1,prod(I)*12); % prod() or sum() as in madhan's ans
추가 답변 (1개)
madhan ravi
2019년 8월 8일
ones(sum(I)*12,1)
댓글 수: 2
Adam Danz
2019년 8월 8일
"and get a 1x48 vector filled by ones"
You'd need to switch around those terms.
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!