Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Drop columns from matrices
ResourceFunction["DropColumn"][mat,n] gives mat with its first n columns dropped. | |
ResourceFunction["DropColumn"][mat,-n] gives mat with its last n columns dropped. | |
ResourceFunction["DropColumn"][mat,{n}] gives mat with its nth column dropped. | |
ResourceFunction["DropColumn"][mat,{m,n}] gives mat with columns m through n dropped. | |
ResourceFunction["DropColumn"][mat,{m,n,s}] gives mat with columns m through n in steps of s dropped. | |
ResourceFunction["DropColumn"][spec] represents an operator form of ResourceFunction["DropColumn"] that can be applied to an expression. |
Drop the first two columns from a matrix:
| In[1]:= |
| Out[1]= |
Drop the third column from a matrix:
| In[2]:= |
| Out[2]= |
Drop the odd columns from a matrix:
| In[3]:= |
| Out[3]= | ![]() |
Drop the last eight columns from a matrix:
| In[4]:= |
| Out[4]= | ![]() |
Drop the third column from a tensor:
| In[5]:= |
| Out[5]= | ![]() |
| In[6]:= |
| Out[6]= | ![]() |
Use the operator form of DropColumn:
| In[7]:= |
| Out[7]= |
Wolfram Language 11.3 (March 2018) or above
This work is licensed under a Creative Commons Attribution 4.0 International License