字段内的结构

T K*_*T K 5 matlab structure

s = struct('field1',...           
        {
        struct('a',num2cell(0 + 4*rand(5,1)),'b',num2cell(0 + 4*rand(5,1)),'c',0);...
        struct('a',num2cell(0 + 4*rand(5,1)),'b',num2cell(0 + 4*rand(5,1)),'c',0)...
        },...
        'field2',...
        {
        struct('a',num2cell(0 + 4*rand(5,1)),'b',num2cell(0 + 4*rand(5,1)),'c',0);...
        struct('a',num2cell(0 + 4*rand(5,1)),'b',num2cell(0 + 4*rand(5,1)),'c',0)...
        }...
       );
Run Code Online (Sandbox Code Playgroud)

如何在每个字段中循环结构以避免列出字段中的每个结构?

Sha*_*hai 0

怎么样

arrayfun( @( w ) structfun( @( x ) arrayfun( @( y ) structfun( @( z ) disp( z ), y ), x ), w ), s )
Run Code Online (Sandbox Code Playgroud)

您可以替换disp为您想要应用的任何功能...