Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

6
votes
1answer
280 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
53 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
97 views

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

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

Select equations with RHS!=0 from a list

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

An issue with Mathematica 10 [on hold]

The following code works as expected (shown in the posts by @kglr and @JMComputer-less): ...
0
votes
1answer
39 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
50 views

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

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
23 views

Filter rows in nested Association / Dataset using Select

The Dataset I am working with has the following nested structure. ...
2
votes
1answer
48 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
170 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
1k 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
31 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[]: ...
2
votes
1answer
29 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
353 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
66 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
50 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
184 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
45 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
251 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: ...
4
votes
2answers
115 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
49 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
59 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: ...
6
votes
2answers
183 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
76 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 ...
7
votes
4answers
265 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" ...
2
votes
4answers
208 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
87 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
132 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
228 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
87 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
456 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
49 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
66 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
97 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
67 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
172 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
53 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
57 views

Selecting elements in nested list

I want to compare elements in a list that looks like this ...
4
votes
4answers
126 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
56 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
53 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
31 views

Problem with Select using a Part [duplicate]

I have the following dataset: ...
5
votes
1answer
82 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 ...
0
votes
0answers
29 views

KalmanFilter fails

I want to use a Kalman filter to reduce the noise in a time series. The underlying process has no dynamic and therefore can be modeled as an AR(1) process like a random walk. ...
4
votes
2answers
80 views

Filtering data with timestamps

How to apply filter to data that was sampled in certain moments of time? Examples from documentation deal only with uniformly sampled data: ...
0
votes
0answers
37 views

How to negate a boolean selection criteria

I know how to select from a list using a boolean function: Select[list, MyFunctionQ] But I can't figure out how to negate this. I've tried ...
5
votes
1answer
157 views

Counting a part of the speech in a sentence

I want to count a number of nouns in a sentence. For that, I'm using TextStructere but I don't know how to get tags of each word.
0
votes
1answer
47 views

Finding integers that do not appear on list [closed]

Let's say I imported a large list of numbers into Mathematica, and found the min value and max value. In that range [min,max], how do I find all integers that do not appear in this list? ...
0
votes
3answers
53 views

Select Elements from a List which are of the form

I have this problem: Produce a list of those of the first 100 primes which are of the form 8k + 1 for an integer k. So far I know how to create a list of the first 100 Primes, simply using; ...
0
votes
1answer
60 views

Finding sequences of same elements in a vector

I am trying to effectively find a number which tells me the number of sequences of ones in a vector of zeros and ones. For example, consider the vector: ...