Assuming you have a table object in MATLAB, you can use the removevars
function to delete one or more columns from the table. Here's an example of how to remove the data
field from a table called mytable
:
main.m39 chars2 lines
This will create a new table with all the columns of mytable
except for data
. If you want to modify mytable
in place (i.e. without creating a new table), you can assign the result back to mytable
:
main.m39 chars2 lines
Note that this only works with tables, not general matrices or arrays. If you're working with a more general data type, you'll need to use standard matrix manipulations to delete the appropriate columns.
gistlibby LogSnag