function [indices, selectedLines] = indexLinesWithPattern(filename, pattern)
    % Read the file into a cell array of strings
    fileContent = readlines(filename);
    
    % Initialize output variables
    indices = [];
    selectedLines = {};
    
    % Loop through each line to find the pattern
    for i = 1:length(fileContent)
        % Check if the line contains the pattern
        if contains(fileContent(i), pattern)
            % Store the index
            indices(end+1) = i;
            % Select the line with the pattern and the next four lines
            selectedBlock = fileContent(i+1:min(i+1, end));
            % Append the selected block to the output cell array
            selectedLines = [selectedLines; selectedBlock];
        end
    end
end