Just kidding, I solved the problem. If it's of any help to anyone in the future with a similar problem and wants to populate a cell array, below is the code which worked for me. The reason why my code in the question above wasn't working was because I was making the empty cell array "names_ranges" inside the for loop. This meant that every loop was erasing the progress from before, and explains why only columns 10 and 11 were populated. I also simplified the code by removing the two arrays "names" and "vRange" and directly populating the cell array with a single sub-loop.
% folder_list contains everything in the parent folder
parent = '/Users/Ritchie/Desktop/Data/Mouse 1';
folder_list = dir(parent);
% Remove non-directoriers so that directoryNames only contains directories
directoryNames = {folder_list([folder_list.isdir]).name};
% Remove '.' and '..' using ismember
directoryNames = directoryNames(~ismember(directoryNames,{'.','..'}));
directoryNames = char(directoryNames);
% Create empty array
names_ranges = cell(14,12);
% Loop through directories
for k = 1 : length(directoryNames)
s = what(directoryNames(k));
myFolder = s.path;
filePattern = fullfile(myFolder, '*.dam');
theFiles = dir(filePattern);
% Perform analysis on the files within each directory
for i = 1 : length(theFiles)
baseFileName = theFiles(i).name;
fullFileName = fullfile(directoryNames(k), baseFileName);
xx = damFileRead(fullFileName);
samples = 1:24415;
Fs = 24.4140625;
t = samples/Fs;
yy = (mean(horzcat(xx.signal),2)); % "2" is needed to average across columns and not rows, which would be "1"
z = range(yy)/3276.5;
% Populate empty cell array <-- this is the important step
names_ranges{i,3*k-2} = baseFileName; % 3*k-2 references the column that's being populated for each main loop
names_ranges{i,3*k-1} = z;
end
end
