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
19
votes
4answers
918 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 ...
0
votes
2answers
54 views

Replace single element of a nested list with multiple elements

I wonder how to replace specific element (even though repeated) within sublists of a nested list with multiple elements while maintaining the list structure. Suppose the following: ...
1
vote
1answer
65 views

Selecting elements using two lists

I made the following list: ...
1
vote
3answers
84 views

Cross checking lists and dropping points that do not belong

I have a list of data that I would like to cross examine with a "correct" list of values and pick out the correct values. For example: ...
5
votes
2answers
161 views

How to use Select for a specific nested list level

I would like to parse every sublist of a nested list and select only those elements that have a certain length, i.e., smaller than 10 elements while maintaining the list structure. Is there any quick ...
5
votes
2answers
217 views

Using DeleteCases to match a string pattern

I am trying to remove all of the elements from a list that contain the characters "err" in that order. I expect the following code to return an empty list: ...
8
votes
2answers
478 views

Ways to speed up Pick

I have a few large arrays (100 times larger than in the example) and I need to re-arrange them. Basically using tests on b and c...
7
votes
2answers
368 views

Deleting duplicates only if they are a certain kind of duplicate

I have a list of tuples like this: {{1,a,b},{1,1,b},{1,a,a},{b,a,1},{b,a,b}} I would like to find a way to delete all those tuples in the list that contain a ...
4
votes
3answers
144 views

Deleting sub-list that contains duplicates

I have a large list of uniform-length lists. What is an efficient way to delete component lists that contain duplicates? For three-item sub-lists, I have used the following code: ...
2
votes
1answer
113 views

DeleteCases does not work with EvenQ? While `Select` works fine [closed]

EvenQ[FromDigits /@ Tuples[{2, 3, 5, 7}, 5]] Works fine. But ...
1
vote
2answers
40 views

Select equations with RHS!=0 from a list

I need to select from a list containing equations those having RHS not zero ...
0
votes
1answer
88 views

How to automatically select solutions from a set of solutions given by Solve?

I have a function of trigonometric functions which must be equated to zero in order to obtain the appropriate results. This is done in the following fashion: ...
0
votes
1answer
59 views

How to replace a special arrow and row in a matrix with a symbol and drop it? [closed]

I need to do a iteration, if condition[i] is true, I want to drop i row and i column in the matrix A. To keep the index of A unchanged, I think I should replace i row and i column as zero or other ...
2
votes
1answer
101 views

Filter rows in nested Association / Dataset using Select

The Dataset I am working with has the following nested structure. ...
2
votes
1answer
66 views

Select elements in a list of tuples of quaternions that satisfy a condition

I defined 24 quaternions using the Quaternions package and i create the list of all possible 4-tuples using ListQuad = Tuples[ListQuaternions, 4] where ...
7
votes
3answers
193 views

Finding items satisfying a condition in a list using patterns

Why the following command Cases[{1, 2, 6, 3, 4, 8, 5}, {x_, y_, z_} /; (y > Max[x, z]):>y] doesn't return the y values that are greater than their ...
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 ...
1
vote
1answer
78 views

how to filter a table based on predicates involving column values

I would like to select a small subset of rows of a table based on a predicate involving multiple columns. Here's a small example of what I want using For[]: ...
0
votes
0answers
44 views

Scraping Images that are Directly Embedded in a Webpage or Dynamic?

I need to scrape URLs for photo albums like Flickr and Facebook for images from a certain event. I'm trying to use Import["link", "Images"], as shown at https://...
2
votes
1answer
34 views

Why does N result in some inconsistency in this context?

In the following, why does N not produce the expected decimal output, while Round does? ...
13
votes
2answers
390 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 ...
1
vote
4answers
119 views

How to extract certain rows satisfying a condition?

I have three columns - P1,P2,M and 411935 rows. I want to extract only those rows which satisfy P1>=P2>=0.25*M. How can I do it?
1
vote
1answer
57 views

How to select terms which contain certain letters?

I would like to select the term Subscript[Cos\[CapitalDelta], Subscript[p, B]] of expression ...
6
votes
3answers
538 views

Remove elements from deep nested list

I have a list like this. How do I traverse the sublists to remove all the 1.'s but leaving the structure intact? I have attempted with Drop[list, {1}] but this ...
0
votes
0answers
63 views

Butterworth single pole, 5 Hz cut-off frequency on accelerometer data for single axis

I have read other posts here on using the Butterworth filter in Mathematica, however, I am having a hard time understanding the chain of functions and their parameters as applied to my case, and I am ...
7
votes
4answers
299 views

Deleting list elements by comparing to another list

I have two lists as follow. The first is p={{"j","d","x"},{"d","k","z"}} and the second one is: ...
5
votes
3answers
218 views

Select the cases by comparing the second elements of the list

Suppose I have a list: l={{1,4},{2,4},{3,5},{4,6},{5,3},{6,2}} How can I select the elements of the list in the second element is decreasing and first element of ...
1
vote
1answer
54 views

Choosing data from list and plot [duplicate]

I have a data set like below: Angle={5.48575, -0.669213, 45.9832, 8.63878, -16.8777, 50.022, -41.8882, -45.956, 28.3005, 35.8234} Now want to select the ...
2
votes
1answer
83 views

Select the right XMLelement

I scrape data from a public website about houses for rent. All pages have the same structure. But the pages can differ in the amount of information. Below I give two examples: page/house 1: ...
7
votes
2answers
237 views

Select UPPER CASE list items with spaces and punctuation

I have a sample list that includes people's names in Title Case, and their companies in UPPER CASE. ...
3
votes
2answers
96 views

How to filter-out edges in a HighlightGraph[] visualization based on VertexCoordinates[]?

I need to visualize a graph spatially, and I'm simply using: HighlightGraph[ConnectedGraphComponents[]] and the known coordinates of the graph's nodes. I really ...
8
votes
4answers
594 views

How to remove “extra” edges from a multigraph?

I programmatically generate many large undirected graphs. Sometimes these graphs are multigraphs, that is, they contain more than one edge between a pair of nodes. I've tried to delete the "extra" ...
4
votes
4answers
452 views

Smoothing noisy data

I have this data shown in picture 1 below and I want to filter it. I tried some filters but I couldn't get good results. seems that I didn't choose the best parameters for it. I want to smooth my ...
3
votes
1answer
96 views

Applying TemporalData to array before filtering gives wrong results

I had a task of filtering data with various timestamps on it, and proceeded as instructed. The first option was to use TimeSeries which works fine but somewhat slow, and the second one TemporalData ...
11
votes
1answer
149 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 ...
8
votes
1answer
267 views

Sample rate severely influences quality of ButterworthFilterModel?

I've hesitated for a while about whether this should be posted to dsp.SE or not, but still decide to discuss it here. Today I was playing with ...
2
votes
1answer
113 views

Butterworthfilter highpass/bandpass

this should be a fairly straightforward question since Mathematica has included functionality to filter data. Nevertheless, I am not being successful to solve the problem. Following the proposed ...
5
votes
4answers
470 views

How to increase the speed of DeleteDuplicates on some selected columns?

I have a data1 with 4 columns and would like to remove the duplications by looking at the first 3 columns. Thus I used below code:- ...
4
votes
1answer
129 views

How to select only some values of an association based on some criteria

Here is the association I have: assc = {"abc" -> 2.456, "efg" -> 3.652, "_final" -> 6.108} I need to remove all key-value pairs where keys start with '_'...
0
votes
2answers
67 views

eliminate product terms in equation [duplicate]

I would like to eliminate all terms that contain the product of dxy, dwz, and dxz, i.e. the final result should read as dxy +b dwz+ c dxz. Thanks in advance for any hint. ...
3
votes
2answers
111 views

Need help charting school shootings by year and number of victims

For my school project I've decided to take some data from Wolfram. I have the dataset from Data Repository, and I want to create three BarCharts. The first one shows the highest number of fatalities. ...
4
votes
2answers
81 views

Deleting elements from a list based on their relative position to one another

I have a data set where I often get pairs of spikes that occur randomly but the pair is always separated within $n$ places of each other. I.e. the spacing between the pairs, in index, is always ...
4
votes
3answers
183 views

Keep only rules that replace integers with other integers

Let's say I have a list of replacement rules: List1 = {2 -> 3, b -> 5.5, 6.57 -> 2, 3 -> 4.5, 1 -> -1, 0.03 -> 0.5, 9 -> a} The desired ...
3
votes
1answer
107 views

Deletion of list elements containing a string character

I have a list: lis = {"ab","a-1","1-20"} from which I need to delete elements of lis that has (only) digits on both sides of the hyphen, in each element that ...
1
vote
2answers
375 views

Selecting elements in nested list

I want to compare elements in a list that looks like this ...
4
votes
4answers
307 views

delete an element list recursively

I have a list, say {10,9,8,7,2,3,5,4,3,2,1} What I want to achieve is to delete the elements that are not in decreasing order recursively. Namely, the output ...
1
vote
0answers
68 views

Filtering list using function values [closed]

I have a list (Basis) of size $2^{21}$, and a binary function $A$ defined on it (only outputs 0 or 1). I want to filter out the items from Basis that $A$ sends to 1. I was able to find the size of the ...
0
votes
2answers
159 views

Remove a term which includes a defined variable from an equation

Is it possible to remove a term which includes a defined variable from an equation? my equation is something like: ...
2
votes
1answer
38 views

Problem with Select using a Part [duplicate]

I have the following dataset: ...
5
votes
1answer
167 views

Find centroids and average intensities of regions in an image

The image below shows an approximately triangular array of bright spots. The intensity falls off towards the edges (Gaussian decay). There are some defects (the elongated smudge and the sharper ...

1 2 3 4 5 11