Stack Exchange Network

Stack Exchange network consists of 175 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 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.

4
votes
4answers
153 views

Dropping list elements from nested list after evaluation

I need to create a new list from a nested list but using the evaluation as criteria to drop the elements. For example let's say that that I have the following list: ...
3
votes
2answers
185 views

Eliminate empty elements from a list with a specific pattern

I am really new in this patterns part of Mathematica. Basically what I need to do is eliminate null elements from a list but that has a specific name before the empty element. For example, my list is: ...
0
votes
2answers
63 views

Separating variables in a set of equations

I have a very large set of equations eqs with variables denoted by capital letters like PVA[2], QA[2], etc. and small letters like ica[1,2], tr[2,3] etc. And I have ...
0
votes
0answers
26 views

Export XYZ matrix selecting positive Z data points in three files and keeping the matrix form

The following code saves XYZ points in a separated file but keeping the matrix shape. ...
1
vote
2answers
43 views

Select one among multiple solutions that satisfies a certain condition and 3D Plot it with varying simulation values

My function is as follows: $$f(x)=ax^5+bx^4+cx^3+dx^2+ex+g=0$$ Since it does not generate an analytical solution, I tried to do a simulation exercise as follows. Simulation values: $a=-2$, $b=3$, $...
5
votes
1answer
54 views

Select Specific StarData

The help menu for StarData has many examples such as StarData[EntityClass[ "Star", {EntityProperty["Star", "DistanceFromEarth"] -> TakeSmallest[10]}]] ...
3
votes
1answer
33 views

How to check format [closed]

I am having troubles with the following data: slavelist = ResourceData["New Orleans Slave Sales 1856-1861"] I want to select all slaves with: ...
4
votes
2answers
63 views

Selecting elements of a list based on frequency

Suppose I have a list as follow: l = {{"a", "b", "c"}, {"a", "b"}, {"a", "d", "b"}, {"a", "c", "e"}}; Now I am going to flatten it and apply ...
4
votes
2answers
148 views

Commonest[] function doesn't actually show commonest elements

I'm using Commonest function on a list with 500000 words to get the 10 most frequent elements. Then by using WordCloud, I found ...
0
votes
1answer
62 views

Solving x'[t]+a*x[t]==0, listing all the solutions, trying to get the value -1x<1 and all corresponding value of a

I am Trying to solve x'[t]+a*x[t]==0,x[0]==1, for x with {t,0,10} using NDSolve. ...
0
votes
0answers
50 views

solving inside for loop and sorting x which are less than 3 and greater than -3 from the list

I give a simple function code here... Clear[a, x, t]; s = ParametricNDSolve[{x'[t] + a*x[t] == 0, x[0]==1}, x, {t, 0, 100}, {a}] y = x[1] /. s y[5] /. s I ...
0
votes
2answers
50 views

Filter lists by discarding sublists that contain integers different from 0 or 1

Imagine I have a list of the type Lst = {{1,0,1,1},{4,0,1,1}, {1,1,0,0},{2,1,1,1},{0,0,0,1}} I want to select only those sublists that only contain elements 0 ...
3
votes
2answers
107 views

How to remove from the data the rows of with fixed number of elements? [closed]

Consider the data which has the form data = {{x1,y1,z1},{x2,y2,z2,t2},{x3,y4,z4,t4},{x5,y5,z5},...} How to remove the rows containing three elements from the ...
1
vote
0answers
36 views

How to get a directed graph of size N which is also a connected component?

I need to get graphs of size N, in which the whole graph is a connected component. In particular, I'm working with a Albert-Barabasi distribution, with k=2, and random directed edges. Right now I'm ...
1
vote
1answer
47 views

How to select the data in a given way?

Consider the data data = {{x1,y1,z1},{x2,y2,z2},{x3,y3,z3},{x4,y4,z4},{x5,y5,z5},{x6,y6,z6},...} with N rows. It can be divided into N/6 sets of 6 rows. I want ...
2
votes
3answers
118 views

Signal Processing [closed]

The image above is the list plot of discrete data I'm working on. Please I need help on how to zero out all the high amplitudes signal from the data. That is all the data in areas circled, I want to ...
2
votes
2answers
93 views

Selecting based on criterion on a single column [duplicate]

I have an array that looks like M = {a, b, c, d}, where a, b, c, d are column vectors. I want to select rows from this array ...
1
vote
0answers
34 views

How to visualize and interactively correct time series data [closed]

I am looking for an efficient method to visualize measured time series data with about 100.000 data points per year, such that eye-catching data points may interactively be tagged as suspicious, e.g. ...
3
votes
0answers
81 views

Select certain term containing some patterns and confusing pattern Alternatives in FreeQ

I am considering a function termsContain[func_,list_] which select in an expression func the terms containing the ones in the ...
5
votes
2answers
164 views

Removing anomalous points from data

I have two sets of 2d-data points which can be transformed in each other by using a certain transformation function. The problem is that in both data sets there are points which do not have ...
4
votes
2answers
119 views

Selecting elements satisfying a condition

I have a list of lists(of lists): ...
5
votes
1answer
129 views

Why Cases and Select treat the List differently?

Look at these two examples: In[1]:=Select[f[i], MatchQ[_f]] Out[1]:=f[] In[2]:=Cases[f[i],_f] Out[2]:={} It seems that the Select take $f[i]$ as List, but Cases ...
4
votes
2answers
112 views

Select certain terms in an expression

I would like to have a function to select terms containing q[i] terms in expressions, for example, for an expression a q[i]+b +c q[j]+d I would like the function ...
3
votes
1answer
159 views

Cleaning away data points which are enveloped within a function

I have some data taken in an experiment which I want to fit and analyse. But before I start fitting function, I want to clean points away in a robust but elegant way. I first provide some sample data ...
3
votes
3answers
120 views

using DeleteCases to delete vectors with particular index as 0

Assume I have a set of vectors set = {{0,1,1,0,1}, {1,0,1,1,1}, {1,1,1,1,0},{1,0,0,1,0}}. I want to delete the vectors which have the last entry as 0. In the ...
1
vote
2answers
121 views

Select items from dataset with GUI using checkbox and Togglebar : empty results with DynamicModule

I have a dataset or records, I want to select records with a GUI (manually ticking on the selected item). Then, I want to apply functions to those items (not in this question). I think Im almost ...
3
votes
3answers
146 views

Filter periodical sharp spikes in experimental data

I have experimental data with periodic sharp artefact spikes, which mask the real signal that could be seen as several negative peaks in the first third part on the curve: Is it possible somehow to ...
3
votes
3answers
104 views

How to use “Cases” for isolating terms of a sum in a nice way?

I'd like to isolate some terms with specific patterns within a sum that I called chunk. ...
6
votes
1answer
121 views

Cases, Pattern, Condition [duplicate]

I supposed Cases would do the list produced as example li = RandomSample[Range[100, 999], 30] ...
19
votes
4answers
902 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
41 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
48 views

Selecting elements using two lists

I made the following list: ...
1
vote
3answers
80 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: ...
4
votes
2answers
106 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
161 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
456 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
333 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
78 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
103 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
35 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
54 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
58 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
62 views

Filter rows in nested Association / Dataset using Select

The Dataset I am working with has the following nested structure. ...
2
votes
1answer
56 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
186 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
39 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
37 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
31 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
369 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 ...