Check for column in table

44 views (last 30 days)
Rohith Sudheer
Rohith Sudheer on 10 Jul 2019
Answered: Shubham Sangle on 10 Jul 2019
How do I search whether a column, lets say 'Column1', exists in a table, Table_1, without using strmatch as it is not recommended.

Answers (2)

Kevin Phung
Kevin Phung on 10 Jul 2019
Edited: Kevin Phung on 10 Jul 2019
strcmp works too, in place of ismember

Shubham Sangle
Shubham Sangle on 10 Jul 2019
Exist_Column = strcmp('My_Column',My_Table.Properties.VariableNames)
val = Exist_Column(Exist_Column==1) ;


Find more on Characters and Strings in Help Center and File Exchange


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!