Check for column in table

조회 수: 55 (최근 30일)
Rohith Sudheer
Rohith Sudheer 2019년 7월 10일
답변: Shubham Sangle 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