Questions tagged [filtering]

Questions on filtering or selecting data based on certain criteria. This is to be used with primary tags such as list-manipulation, string-manipulation or signal-processing, with the primary tag indicating the specific use case.

Filter by
Sorted by
Tagged with
95
votes
4answers
3k views

What best practices or performance considerations are there for choosing between Cases, Position, Pick and Select?

Cases, Select,Pick and Position each have different ...
70
votes
6answers
5k views

Does Mathematica have advanced indexing?

I have two $M \times K$ arrays $L, T$ where I would like to set all the elements in $L$ to zero whenever the corresponding element of $T$ is greater than 15. The ...
38
votes
9answers
5k views

Removing elements from a list which appear in another list

There are two lists {a, b, c, a, d, a, e} and {a, c, a}. I need to remove those elements from the first list which appears in a second list, to get {b, d, a, e}
36
votes
3answers
6k views

Remove noise from data

Hi, as you can see above I have some experimental data which has a large offset and shows clear noise fluctations around the tendency of the curve. I wanted to ask if someone could suggest me a method ...
33
votes
7answers
23k views

Selecting every n-th element from a list

I have a list: data = {4, 5, 7, 8, 9, 5, 3, 2, 1, 2, 13, 12}; I want to take those elements in the list which are located at equal distances, say, every third ...
24
votes
4answers
5k views

Savitzky-Golay Filter to smooth noisy data

I do have noisy data and want to smooth them by a Savitzky-Golay filter because I want to keep the magnitude of the signal. a) Is there a ready-to-use Filter available for that? b) what are ...
23
votes
3answers
1k views

Select performance

I am fairly new to mathematica and working my way thru Paul Wellins book on Mathematica programming so experimenting with various language constructs. I was experimenting with ...
21
votes
14answers
3k views

Pick elements of largest absolute value

For example, given list = {{1, -3, -5}, {2, 1, 6}, {0, 2, 4}, {-9, 2, 6}} should return: {-5, 6, 4, -9} Updated I found ...
21
votes
13answers
4k views

How to get list of duplicates when using DeleteDuplicates?

This might be easy, but can't find a way to use DeleteDuplicates to get also list of the actual duplicates. Example: ...
20
votes
2answers
487 views

Clean and handy Options management/filtering

the case I want to be able to create a function with some default options but also without need to add full explicit list of options available for it. And then inside I want to be able to filter ...
19
votes
8answers
1k views

How do I delete all items that occur more than once?

DeleteDuplicates works fine but leaves a single copy of the duplicated item. I need to remove all items that occur more than once i.e. {{1,2},{1,2},{3,4}} -> ...
19
votes
4answers
920 views

How to construct a list of lengths efficiently

Say I have a sorted list of integers RandomInteger[{1, 100000}, 10000] // Sort // Short I want to construct another list whose $m$-th element is the number of ...
19
votes
5answers
494 views

Find duplicates in list of InfiniteLine

MMA 10 introduced a new function, which can be very convenient: InfiniteLine. Of course, two infinite lines can be described by different arguments: for example <...
19
votes
2answers
979 views

Is it possible to Parallelize Select?

Given a large list of elements, is it possible to improve Select by parallelizing? An example: from a 10,000,000-element list of integers between 1 and 10, select ...
18
votes
5answers
877 views

Easiest/most efficient way to delete duplicates from one list at the positions of another?

This question is somewhat related to How to efficiently find positions of duplicates? , although I'm interested in something a little bit simpler since I'm not really interested in a list of all the ...
18
votes
2answers
1k views

Why the BandpassFilter is different than applying LowpassFilter then HighpassFilter

If I generate some data with noise, and use a filter to filter the noise, why does BandpassFilter not produce the same results as using ...
17
votes
7answers
5k views

How to find rows that have maximum value?

Suppose if I have following list { {10,b,30}, {100,a,40}, {1000,b,10}, {1000,b,70}, {100,b,20}, {10,b,70} } How to find rows that have max value in ...
17
votes
7answers
953 views

How to find all the positions of max value of a list efficiently?

For Example, list=RandomInteger[{1,100},2000]. Yes,I know Position[list,Max[list]] can do. But it's based on pattern matching!...
17
votes
3answers
1k views

Performance of Select

I have a dataset of 3D coordinates with a length of about $ 4\times 10^6 $. From this volume I am sequentially selecting coordinates along one axis and manipulating this subset. My question: Can the ...
17
votes
3answers
5k views

How to remove outliers from data

I have a data with noise which some times includes significant outliers. The position of the outliers are random. For example: ...
16
votes
7answers
2k views

Deleting sublists from lists

I have a list consisting of symbols and integers. I would like to delete the integers from the list only if a symbol precedes and follows each integer: ...
16
votes
4answers
1k views

How to get cell boundaries in the image?

I have a microscope image of some animal tissue and wish to get the contours for all the cells that are present in the image. the cells are connected to the neighbouring cells via these contours. At ...
16
votes
5answers
4k views

Select/Delete with Sublist elements?

Probably easy and short question, I still didn't fully figure out how to easily select/delete sublists from a list. Example: tt = {{2, 4}, {4, 8}}; I want to ...
16
votes
4answers
916 views

Solving chess bishop problem

I have generalized the problem in this way where I have a list list=Tuples[Range[8],2] I want to find the largest sublist in which the addition of the two ...
16
votes
3answers
712 views

Select seems unusually slow

I haven't been doing nearly as much Mathematica as I really should for the past few months, and in order to get my head back in the game I've been using it to run roughshod over easy Project Euler ...
15
votes
11answers
1k views

Delete redundant {x,y} pairs

Working through the problems from Hazrat's Mathematica book and there's a simple exercise to find all the square numbers where $n^2+m^2=h^2$ yields $h$ as an integer (I think they're also called ...
15
votes
2answers
192 views

Most efficient numerical selectBetween

Often when I'm working with numerical data I want to select those points within a given range. To do this I generally do something like: ...
15
votes
1answer
431 views

Why does this line increase the consumed memory?

Probably this is a simple question, however I really don't understand this behavior in Mathematica. It particularly leads to a memory leak in a huge program I have to do processing of 3D images. I ...
14
votes
5answers
388 views

Complicated list slicing

Say I have a list with the structure list = {{1, {x1, y1, z1}}, {2, {x2, y2, z2}}, {3, {x3, y3, z3}}, ...} I would like to slice it such that I end up with <...
14
votes
4answers
325 views

Fast Selections Testing on Inequality

Is there a functional idiom for fast selections testing on inequality? For example, finding values from list a & b where the key is less than or equal to a value, in this case 4 or 9. An ...
13
votes
2answers
846 views

Using Except with strings

Suppose that I have the following sample list, called list: list = {"bBb", "aAa", "aaa"}; Now suppose I want to select the ...
13
votes
2answers
391 views

How to build a list of elements satisfying a certain property without building a list of all elements first?

Is there a way to directly build a list of elements that satisfy a certain property? More precisely, I am looking for a function IncludeIf (this is a placeholder ...
13
votes
2answers
2k views

Filtering and Replacing outliers

I have a set of data that measurements of temperature vs time (date). It is easy to realize when the sensor went wrong as one might see a blip on the data. How to teach to Mathematica to: 1) Detect ...
13
votes
1answer
244 views

KeyDrop does not respect Key in V11

KeyDrop[<|a -> 1|>, Key[a]] <|a -> 1|> ...
12
votes
10answers
2k views

Given a list of integers, find the largest sum of a contiguous subsequence

Given a list of integers, find the largest sum of a contiguous sub-sequence. {1, 2, 3, 4, 5, -1, 7, -4, -2} (* 21 *) And print the sub-array which is ...
12
votes
6answers
650 views

How do I prune a list of pairs of numbers so that each number occurs on only one pair?

How do I select only the first pair of numbers in which a number occurs from a list of pairs of numbers? For example, I have ...
12
votes
3answers
1k views

Interpolate the noisy data

I have some noisy data ...
12
votes
5answers
596 views

Select the same elements from lists

I need a special intersectant operation for List other than Set. There maybe some duplicate elements, also need to count instead of merging as Intersection. For ...
12
votes
1answer
326 views

Ordered RandomSample

This feels like a basic question yet I failed to find an answer. ...
12
votes
1answer
176 views

Using Select on Dataset with missing keys

I have a very large dataset with about a million entries with up to 75 keys each. Across the whole dataset about half of the keys are blank. In order to reduce filesize, I have used the following ...
11
votes
7answers
3k views

How to select all elements above the main diagonal of matrix?

How to select all elements above the main diagonal of matrix? I need to create a list of them.
11
votes
3answers
432 views

How to remove a line of a matrix if not all elements are numeric?

I have a matrix a n columns and m lines. I'd like to efficiently remove the lines that are not entirely composed of numeric ...
11
votes
6answers
1k views

Fast way of finding position of Interval containing an Integer

I have a large list (about 2.2 million) of pairs of integers. Each pair defines an Interval[{}]. Given some integer x, I need to ...
11
votes
4answers
10k views

Removing all values from a list that satisfy a given condition

Suppose I have a list, list = Table[{n}, {n, 1, 5}] (* list = {{1},{2},{3},{4},{5}} *) and I want to remove all values from this list that are greater than 3, so ...
11
votes
2answers
720 views

Select cases from a list

I have a list in the form : {1,1,1,0,-1,-1,1,1,1,0,0,0,0,-1,-1} No I'm trying to select only those sequences which start with 1 have a zero (or many zeros) ...
11
votes
3answers
392 views

How to speed up Select with MemberQ for large lists?

I have two large lists: list1 and list2. I would like to select elements of list1 only if they appear in list2. Since the list1 has dimensions of (335000, 2) and list2 : (122000, 4), it's taking a ...
11
votes
1answer
482 views

Deconvolution of Image3D object using ImageDeconvolve

Bug introduced in 9.0 and fixed in 10.0 I am trying to get the ImageDeconvolve function to work with Image3D objects. In the documentation of ...
11
votes
1answer
150 views

How to delete lists that contain sublists of different sizes?

I hope to have your help, if I have listp = Permutations[Range[7]]; With the following functions, I delete the lists that contain ...
11
votes
1answer
566 views

Select From List of Nested Associations

I have an association: ...
10
votes
6answers
522 views

Faster way to do this smoothing?

Looking for a pleasing way to smooth a particular dataset I found something I like but it is rather slow to compute: I take the mean of a series of MedianFilter ...

1
2 3 4 5
11