I have also tried the wiki (https://matlab.fandom.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F) using the code below but get the following error. 'Subscripted assignment between dissimilar structures'.
% Get a list of all mat files in the current folder, or subfolders of it.
fds = fileDatastore('*.mat', 'ReadFcn', @importdata);
fullFileNames = fds.Files
numFiles = length(fullFileNames)
out = struct();
% Loop over all files reading them in and plotting them.
for k = 1 : numFiles
fprintf('Now reading file %s\n', fullFileNames{k});
out(k) = load(fullFileNames{k});
end