필터 지우기
필터 지우기

Remove null rows from a structure before converting to table

조회 수: 5 (최근 30일)
AG15
AG15 2023년 3월 9일
편집: Stephen23 2023년 3월 10일
Hi,
I am using a struct2table on a structure which has a few null rows as shown below:
When I try to use struct2table on this it gives me
3×2 table
A B
____________ ____________
{0×0 double} {0×0 double}
{0×0 double} {0×0 double}
{[ 1]} {[ 2]}
Is there a way to only convert the rows with the non null values, that would remove the braces when I convert it? Thanks a lot!

채택된 답변

Stephen23
Stephen23 2023년 3월 9일
편집: Stephen23 2023년 3월 10일
S = struct('A',{[],[],1},'B',{[],[],2})
S = 1×3 struct array with fields:
A B
X = arrayfun(@(s)any(structfun(@isempty,s)),S);
T = struct2table(S(~X))
T = 1×2 table
A B _ _ 1 2

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

태그

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by