function varData = gather_Altitude(fileList, indices, variableName)
    % GATHERARCHIVE Extracts a variable with a given name from a list of .h5 files
    %
    % Inputs:
    %   - fileList: A cell array of strings representing the file names or paths
    %               of the .h5 files to extract the variable from
    %   - variableName: A string representing the name of the variable to extract
    %
    % Output:
    %   - varData: A cell array of matrices representing the values of the
    %              variable in each of the .h5 files

    % Initialize the output variable
    varData = cell(length(fileList), 1);

    % Loop through each file in the list
    for i = 1:length(fileList)
            [path, filename, ext] = fileparts(fileList{i});
            h5_path = strrep(path, '/PBLH','/Archive_ml/');
            h5_file = strcat(filename,'.h5');
            full_path_h5 = strcat(h5_path,h5_file)
            %Read in indices and variables
            idx = indices{i};
            for l = 1:length(idx);
                idx_prof = idx{l}
                variable = h5read(full_path_h5, ['/DataProducts/',variableName]);
                disp(size(variable))
                if ~isempty(idx)
                    varData{i} = mean(variable(idx_prof));
                else
                    varData{i} = NaN;
                end
            end 
    end

end







