Delete the front zero elements from vector
情報
この質問は閉じられています。 編集または回答するには再度開いてください。
古いコメントを表示
Hello everyone
I want to delete the front zero element from vector. I receive a input vector, for example,
a=[0 0 0 2 4 0 8 9 0 3]
how can I get
a=[2 4 0 8 9 0 3]
Thank you
Famuto
0 件のコメント
回答 (1 件)
Azzi Abdelmalek
2013 年 11 月 26 日
編集済み: Azzi Abdelmalek
2013 年 11 月 26 日
a=[0 0 0 2 4 0 8 9 0 3]
a(cumsum(abs(a))==0)=[]
or
a=a(find(a~=0,1):end)
1 件のコメント
chi ha ko
2013 年 11 月 26 日
この質問は閉じられています。
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!