Filling blanks with zeros
4 ビュー (過去 30 日間)
古いコメントを表示
Hello, I have a vector of 1175 values. The vector begins with the following values: 1983, 2004, 2054, 2094, 3107, 3137 etc. Is it possible to fill in the blanks between the values with zeros? So it would be 1982 times 0, than the value 1983, 21 times 0, than the value 2004, 50 times 0, than the value 2054 and so on...
Thanks in advance! Shawn Imming
0 件のコメント
採用された回答
Walter Roberson
2016 年 11 月 7 日
maxval = max(YourVector);
NewVector = zeros(1, maxval);
NewVector(YourVector) = YourVector;
参考
カテゴリ
Help Center および File Exchange で Surface and Mesh Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!