How to select a certain range in the middle of my data?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
David
le 5 Juil 2022
Réponse apportée : Star Strider
le 5 Juil 2022
I have a set of experimental data x,y. x goes between different values, and I want to remove a range of values inside (think x has values from 0 to 10 and I want to remove the range betweeen 5 and 6). How can I remove the values for both x and y data?
I am importing the data as follows:
RealData=Importdata('datafile.txt');
This gives me a matrix with x and y in two columns. The matrix will be different in different cases, so I want to be able to remove the data by giving the values of x between which I don't want the data, as the indexes will vary from case to case.
I have seen ways to remove data after a certain value, but not a range in the middle.
0 commentaires
Réponse acceptée
Star Strider
le 5 Juil 2022
There are different ways to do this.
One approach —
ReadDataX = 0:0.5:10
ReadDataY = randi(9,size(ReadDataX))
Lv = ReadDataX<5 | ReadDataX>6;
NewDataX = ReadDataX(Lv)
NewDataY = ReadDataY(Lv)
.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Logical dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!