here is the code I have so far...
myDir = uigetdir; %gets directory
ds = tabularTextDatastore(myDir,'FileExtensions','.csv');%get a list of all the csv files in the folder
fileNames = (ds.Files); %generate a variable with the actual file names
for k = 1:numel(fileNames)
fid = readtable(fileNames(k)); % read the file in position 'k' in the fileNames array
PathLength = fid(:,5); % read the 5th column from the csv file
write = {fileNames(k), PathLength}; % make an array of what I want to write to an excell file
xlswrite('data',write,(A,k)); %write it in an excell file in column a row(
end