Input :
% Load a single file
file_path = 'C:\Users\Windows 10\Dataset\dataset\AD_Data_origanl mat file\Dataset 1\preproctrials01.mat';
loaded_data = load(file_path);

% Display the structure of the loaded file
disp(loaded_data);

Output: 
    data: [1×1 struct]
	
Input:
% Define the folder path
data_folder = 'C:\Users\Windows 10\Dataset\dataset\AD_Data_origanl mat file\Dataset 1';

% List all 23 .mat files in the dataset folder
file_list = dir(fullfile(data_folder, 'preproctrials*.mat'));

% Initialize variables to store trials and metadata
all_EEG_data = {};  % To store trials (EEG data) from all files
fs = [];  % Sampling frequency (should be constant at 256 Hz)
channel_labels = {};  % EEG channel names (same for all files)

% Load data from all 23 files
for file_idx = 1:length(file_list)
    % Load the .mat file
    file_path = fullfile(file_list(file_idx).folder, file_list(file_idx).name);
    loaded_data = load(file_path);
    
    % Access the substructure (likely named "data")
    data_structure = loaded_data.data;
    
    % Extract sampling frequency and channel labels (only needed once)
    if isempty(fs)
        fs = data_structure.fsample;  % Sampling frequency
        channel_labels = data_structure.label;  % Channel labels
    end
    
    % Extract EEG trials (each is 16x1280 matrix)
    num_trials = length(data_structure.trial);
    for trial_idx = 1:num_trials
        all_EEG_data{end+1} = data_structure.trial{trial_idx};  % Store each trial
    end
end

% Output some information about the data
disp(['Number of trials loaded: ', num2str(length(all_EEG_data))]);
disp(['Number of EEG channels: ', num2str(length(channel_labels))]);
disp(['Sampling frequency (Hz): ', num2str(fs)]);

Output:
Number of trials loaded: 663
Number of EEG channels: 16
Sampling frequency (Hz): 256

now here total number of trials are different in each file, but eeg channel and sampling frequency are same
here are all the info of each files

for all 23 .mat files fsample, sampleinfo, label and cfg were and the value of all of them are as shown below
fsample = 256
sampleinfo = [1,1280]
label = 16x1 cell
cfg = 1x1 struct

for all 23 .mat files value of trial and time were differen from each other
preproctrials01.mat (trial & time value) = 1x35
preproctrials02.mat (trial & time value) = 1x25
preproctrials03.mat (trial & time value) = 1x10
preproctrials04.mat (trial & time value) = 1x33
preproctrials05.mat (trial & time value) = 1x1
preproctrials06.mat (trial & time value) = 1x22
preproctrials07.mat (trial & time value) = 1x3
preproctrials08.mat (trial & time value) = 1x32
preproctrials09.mat (trial & time value) = 1x18
preproctrials10.mat (trial & time value) = 1x38
preproctrials11.mat (trial & time value) = 1x47
preproctrials12.mat (trial & time value) = 1x37
preproctrials13.mat (trial & time value) = 1x29
preproctrials14.mat (trial & time value) = 1x39
preproctrials15.mat (trial & time value) = 1x46
preproctrials16.mat (trial & time value) = 1x28
preproctrials17.mat (trial & time value) = 1x59
preproctrials18.mat (trial & time value) = 1x40
preproctrials19.mat (trial & time value) = 1x46
preproctrials20.mat (trial & time value) = 1x37
preproctrials21.mat (trial & time value) = 1x19
preproctrials22.mat (trial & time value) = 1x17
preproctrials23.mat (trial & time value) = 1x2


this explain why Output was:
Number of trials loaded: 663
Number of EEG channels: 16
Sampling frequency (Hz): 256

now next what should we do?