How can i delete certain numbers of an array
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (2)
Ameer Hamza
am 10 Dez. 2020
You can use logical indexing
w = linspace(0 , pi , 260);
idx = (w > 0.4*pi) & (w < 0.5*pi);
w(idx) = []
Star Strider
am 10 Dez. 2020
One approach:
w = linspace(0 , pi , 260);
we = w((w < 0.4*pi) | (w > 0.5*pi)); % ‘w’ Edited
.
Siehe auch
Kategorien
Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!