MATLAB: Find column names with particular names in MATLAB table

column searchcolumnnamesfindbycolumnnameregextable

Hi there,
I have a massive table with 408 columns in MATLAB. I want to get rid of columns that start with the word "connected". Instead of having to manually check the table and do something like
finalnbs(:,212:364) = [];
Where
finalnbs
is the table, how do I find all columns in finalnbs which start with connected e.g.
connected*
And then remove those?

Best Answer

finalnbs(:,strncmp(finalnbs.Properties.VariableNames, 'connected', length('connected')) ) = [];