How to check whether a specific variable is empty or not in table type

조회 수: 21 (최근 30일)
Hi, please see the follwing figure.
As you can see, in this 'table' type variable, some rows does not have 'ls_max_tone' and some have 'ls_max_tone' .
'ls_max_tone' variable is defined as 'cell' type.
I can find which row has 'ls_max_tone' variable using for loop. However, I know this is not efficient way.
Is there any efficient way such as
T_data(T_data.temperature >50, :)
which returns all rows that temperature value exceeds 50.
Thanks in advance.

채택된 답변

Tommy
Tommy 2020년 4월 17일
T_data(~cellfun(@isempty, T.ls_max_tone),:)
This will return a table containing only the rows where ls_max_tone is not empty.
  댓글 수: 1
Sangmin Lee
Sangmin Lee 2020년 4월 17일
Thanks a lot!
I am always having difficulty in using cell array and cell function (@).
It works!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by