Get Fields and its subfields

2 次查看(过去 30 天)
Marlo Wegener
Marlo Wegener 2016-5-12
Hello, I'm currently trying to store all fields and its containing subfields in a cell array and encounter problems using 'fieldnames'. I thought it would be the easiest way to write recursive code to solve this... Lets say I have a fields with subfields as follows: A.b.c.d A.b.c.a A.b.d.a A.b.d.b and so on. In this case the main field A has a couple of subfields and some of those have their subfields. Is there an easy way to extract all fields with its subfields? I tried to do it using 'getfield', 'fieldnames', 'strsplit' and 'strcat' but did not really succeed.
  1 个评论
Jos (10584)
Jos (10584) 2016-5-12
编辑:Jos (10584) 2016-5-12
What should the final output look like? Can you give an example?
A.b.c.d = 3
A.b.x = 2
FinalOutput = somefunction(A)
% FinalOutput = ...

请先登录,再进行评论。

回答(0 个)

类别

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