@Hussein Kokash Not sure whether your files are located in a single folder or not. If it is in single folder then you can make use of below code..
loc='/Volumes/Backup Plus/path/'; % put path of your data files
cd(loc)
fnames=dir(fullfile('*.txt')); % Put the extension of your files
output=[];
for i=1:numel(fnames)
filename=fnames(i).name;
data = dlmread(filename) % I would suggest you to use readmatrix instead of dlmread.
z = data(:,1);
y = data(:,2);
T=data(:,3);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % fft method
[fhz,fft_spectrum] = do_fft(z(:),y(:));
[amplitude1, idx] = max(fft_spectrum);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
L = length(z);
fs = 1/mean(diff(z)); % Sampling Frequency
fn = fs/2; % Nyquist Frequency
yc = y - mean(y); % Sampling Interval
FTv = fft(yc)/L; % Fourier Transform
Fv = linspace(0, 1, fix(L/2)+1)*fn; % Frequency Vector
Iv = 1:length(Fv); % Index Vector
[max_FTv, maxidx] = max(FTv(Iv));
Fv_at_max_FTv = Fv(maxidx);
wavelength1=1/Fv_at_max_FTv;
output=[output;wavelength1];
end
If you want to save wavelength, then you can find it in output. You can save your desire outputs this way.