How can i delete certain numbers of an array
1 回表示 (過去 30 日間)
古いコメントを表示
Hi, i have and array with numbers [ 0 , pi ] and i want to delete all the samples from 0.4*pi to 0.5*pi to have one array with numbers between [0,0.4*pi] and [0.5*pi , 0] .
How can i do it ?
w = linspace(0 , pi , 260);
0 件のコメント
回答 (2 件)
Ameer Hamza
2020 年 12 月 10 日
You can use logical indexing
w = linspace(0 , pi , 260);
idx = (w > 0.4*pi) & (w < 0.5*pi);
w(idx) = []
Star Strider
2020 年 12 月 10 日
One approach:
w = linspace(0 , pi , 260);
we = w((w < 0.4*pi) | (w > 0.5*pi)); % ‘w’ Edited
.
参考
カテゴリ
Help Center および File Exchange で Matrices and Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!