I'm trying to analyse data with Mathematica. I have a big array with various columns representing timestamps and then lots of data. I have some code that will produce a list of timestamps when the data is bad and should be deleted.
I would like to be able to take any new set of data and identify the position of any timestamps that are in the list of bad data and should be deleted.
To put it bit more precisely, given list A and list B is there way to output the position where of any member of list A occurs in list B.
I have some terrible code that does the job, but I'm sure there is a nicer way to do this with a function that just has two lists as the input. In this code datatimelist is the time stamps of the new data, and glitchtimelist is the previously identified timestamps of bad data from a different experiment.
datatimelist = thedata[[All, 3]]
match[x_] := MemberQ[glitchtimelist, x];
badpointlist = Position[Map[match, datatimelist], True];
datadeglitched = Delete[thedata, badpointlist];
Thanks Fred.
Pick[]
. $\endgroup$Complement
orIntersection
to find what sets of elements you want, thenPick
orDelete
elements based on the result. $\endgroup$glitchtimelist={2,3}
for the glitches anddatatimelist={{1,2.31231},{2,2.11241},{3,2.55345},{4,2,23452.6},{5,2.22352}
for the timestamps and data. I want to know the position of the points {2,2.11241} and {3,2.55345} since the have a timestamp that's in glitchtimelist. I would also love it in the form of a function that can have two lists as the input $\endgroup$Pick[thedata, Not@*match /@ datatimelist]
$\endgroup$