function [value]=struct_get_field(strct,field)
% usage:  sn=struct_get_field(meta,'SN');
value=[];
dbg=0;
fns=fieldnames(strct);
for ii=1:length(fns)
    fn=char(fns{ii});
    if dbg==1, fprintf('%s\n',fn);end
    if strcmpi(fn,field)
        eval(['value = strct.' fn ';']);
        return
    else
 
        acmd=sprintf('strct2 = strct.%s;', fn);
        if dbg==1, fprintf('%s\n',acmd);end
        eval(acmd);
        if isstruct(strct2)
            fns2=fieldnames(strct2);
            for ii2=1:length(fns2)
                fn2=char(fns2{ii2});
                if dbg==1, fprintf('%s %s\n',fn,fn2);end
                if strcmpi(fn2,field)
                    eval(['value = strct2.' fn2 ';']);
                    return
                else
                    
                    acmd=sprintf('strct3 = strct2.%s;', fn2);
                    if dbg==1, fprintf('%s\n',acmd);end
                    eval(acmd);
                    if isstruct(strct3)
                        fns3=fieldnames(strct3);
                        for ii3=1:length(fns3)
                            fn3=char(fns3{ii3});
                            if dbg==1, fprintf('%s %s %s\n',fn,fn2,fn3);end
                            if strcmpi(fn3,field)
                                eval(['value = strct3.'  fn3 ';']);
                                return
                            else
                                acmd=sprintf('strct4 = strct3.%s;', fn3);
                                if dbg==1, fprintf('%s\n',acmd);end
                                eval(acmd);
                                if isstruct(strct4)
                                    
                                    fns4=fieldnames(strct4);
                                    for ii4=1:length(fns4)
                                        fn4=char(fns4{ii4});
                                        if strcmpi(fn4,field)
                                            eval(['value = strct4.'  fn4  ';']);
                                            return
                                        else
                                            value=[];
                                        end
                                    end
                                end
                            end
                        end
                    end
                end
            end
        end
    end
end