Linked Questions
15 questions linked to/from How to use "Drop" function to drop matrix' rows and columns in an arbitrary way?
14
votes
2
answers
443
views
`Part` like `Delete`: How to delete list of columns or arbitrarily deeper levels [duplicate]
On trying to write this answer I reached the frustrating realization that I didn't have an efficient way to delete a list of columns or deeper level components in a simple way as ...
5
votes
2
answers
472
views
How do I use drop to drop the second element from all these sublists? [duplicate]
{{1, 2}, {2, 3}, {5, 4}}
I tried to do this:
Drop[#, {2}] & @@ {{1, 2}, {2, 3}, {5, 4}}
but it gave
{1}
but what I want is
{{1},{2},{5}}
4
votes
2
answers
963
views
How do I delete items at the same position from every sub-list within a list? [duplicate]
We have data in a list called megadata where megadata[[1]] for instance are the temperatures of each data point, ...
2
votes
2
answers
94
views
How to edit a list according to the other list? [duplicate]
Gday guys. This problem troubles me, and I hope you can help me solve it.
Say I have two random lists
L1={{2},{5},{1},{0},{4},{7},{8}}
L2={2,5,1,0,4,7,8}
and ...
198
votes
9
answers
73k
views
Elegant operations on matrix rows and columns
Question
The Mathematica tutorial has a section 'Basic Matrix Operations', describing operations like transpose, inverse and determinant. These operations all work on entire matrices. I am missing a ...
18
votes
7
answers
3k
views
Given a large binary matrix, find the largest submatrix containing non-zero elements
I'm looking for a way to reduce a binary matrix containing zeros at some positions into a matrix that contains no zeros by deleting rows and columns of the original matrix until only non-zero values ...
14
votes
3
answers
20k
views
Correct way to remove matrix columns?
I start off with m = 1000 x 5 matrix, and I would like to remove first column to get 1000 x 4 matrix and repeat again for ...
15
votes
3
answers
1k
views
Benchmarking expressions
It often happens that I'd like to know which of two or more alternative expressions (that should evaluate to the same value) is fastest. For example, below are three ways to define a function:
...
5
votes
3
answers
4k
views
List manipulation: Dropping first or last row or column of a matrix
How do I drop the first/last row or first/last column from a matrix? The general case is answered here but I am new to Mathematica and it the arbitrary case is unnecessarily complex.
Suppose I am ...
6
votes
3
answers
228
views
Looking for a better way to delete an arbitrary list of rows from a matrix
Delete is not suitable to delete the rows of a matrix, as illustrated below:
...
11
votes
1
answer
523
views
Drop selection of columns from a ragged array
I have an application where I need to drop some arbitrary list of columns from a ragged array (where of course the shortest array rows have at least all the specified columns).
E.g., given a ragged ...
3
votes
3
answers
617
views
Matrix manipulation
Thank you for looking and answering this question. I am trying to create a new matrix from an old one. Meaning, I have a original matrix that's 20x20. I want to keep the first five lines of the matrix,...
3
votes
2
answers
2k
views
Adding extra column to an existing table [duplicate]
Suppose I have following table-
1 5 8
2 6 9
3 7 10
0 0 0
Now, I want to add another column by exporting a data file. Suppose contents of that ...
3
votes
3
answers
135
views
Inverse of ArrayPad operation, or removal of first column and first row of matrix [duplicate]
I have some large matrices, which I need to remove the first row and first column (both of which are full of zeroes). In this sense I need the inverse of "ArrayPad".
For example, consider the matrix:
...
2
votes
1
answer
312
views
Multiple swapping of rows and columns
m={{a, b, c, p}, {d, e, f, x}, {g, h, k, z}, {u, v, w, y}};
I want to swap 1st and 2nd rows by 4th and 3rd rows respectively. And then, swap 1st and 2nd columns ...