Check for column in table

50 次查看(过去 30 天)
Rohith Sudheer
Rohith Sudheer 2019-7-10
How do I search whether a column, lets say 'Column1', exists in a table, Table_1, without using strmatch as it is not recommended.

回答(2 个)

Kevin Phung
Kevin Phung 2019-7-10
编辑:Kevin Phung 2019-7-10
any(ismember(Table_1.Properties.VariableNames,'Column1'))
strcmp works too, in place of ismember

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

类别

Help CenterFile Exchange 中查找有关 Characters and Strings 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by