delete zero elements from vector
13 ビュー (過去 30 日間)
古いコメントを表示
Hi
I have k (1,600) size, it contain zeros at 451-600 elements.
I want to delete these zero elements. At the end of this vector i want to add two elements with value equal to the last element .
thank you in advance
0 件のコメント
採用された回答
その他の回答 (1 件)
Setsuna Yuuki.
2020 年 11 月 18 日
You can use:
k(k==0) = [];
k(length(k)+1:length(k)+2) = k(1,length(k));
参考
カテゴリ
Help Center および File Exchange で Mathematics and Optimization についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!