function data = processDirectory(folderPath, data)
    % 获取文件夹中的所有文件和子文件夹
    files = dir(fullfile(folderPath, '*'));
    
    % 遍历文件
    for k = 1:length(files)
        if ~files(k).isdir
            % 这里处理文件

            di = [files(k).folder '\' files(k).name];
            %di = 'E:\huawei_mem\new\success\daily\data\a01\p1\s01.txt';

            disp(di);
            s1 = strsplit(di, '\\a');
            disp(s1{2});
            s2 = strsplit(s1{2}, '\\p');
            da = int32(str2num(s2{1}));
            disp(da);
            
            s3 = strsplit(s2{2}, '\\s');
            xiao = int32(str2num(s3{1}));
            disp(xiao);

            temp = importdata(di,',');
            temp2 = reshape(temp, 1, []);

            %disp(temp);
            data = [data; temp2];
        else
            % 递归调用以遍历子文件夹
            if ~strcmp(files(k).name, '.') && ~strcmp(files(k).name, '..')
                data = processDirectory(fullfile(folderPath, files(k).name), data);
            end
        end
    end
end