How do I determine if a column header exists in a table?
Mostrar comentarios más antiguos
I am performing a readtable() command. Sometimes the table contains a column called "x"; sometimes it is called "y". How would you determine if one column exists or not. I looked through the is* functions but did not see anything that I could use in an if statement.
Respuestas (1)
I would access the table varaible names and check if 'x' is a member or not.
T = readtable('patients.xls')
varNm = T.Properties.VariableNames
any(ismember('X',varNm))
Categorías
Más información sobre Tables en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!