function [trainFiles, testFiles] = split_files(allFiles, trainPercentage)
    % Splits files into training and testing sets
    % Input:
    %   - allFiles: Cell array containing file paths
    %   - trainPercentage: Percentage of files to use for training (e.g., 80 for 80% training)
    % Output:
    %   - trainFiles: Cell array of file paths for training
    %   - testFiles: Cell array of file paths for testing

    numFiles = length(allFiles);

    % Randomly shuffle the files
    shuffledFiles = allFiles(randperm(numFiles));

    % Calculate the number of files for training based on the percentage
    numTrainFiles = round(trainPercentage * numFiles / 100);

    % Assign files to training and testing sets
    trainFiles = shuffledFiles(1:numTrainFiles);
    testFiles = shuffledFiles(numTrainFiles + 1:end);
end










