How to decompose and expand a vector into ones
1 回表示 (過去 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 で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!