Remove null rows from a structure before converting to table

5 次查看(过去 30 天)
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