Check for column in table

50 visualizaciones (últimos 30 días)
Rohith Sudheer
Rohith Sudheer el 10 de Jul. de 2019
Respondida: Shubham Sangle el 10 de Jul. de 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.

Respuestas (2)

Kevin Phung
Kevin Phung el 10 de Jul. de 2019
Editada: Kevin Phung el 10 de Jul. de 2019
any(ismember(Table_1.Properties.VariableNames,'Column1'))
strcmp works too, in place of ismember

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

Categorías

Más información sobre Characters and Strings en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by