add analysis loop

This commit is contained in:
Silas
2024-11-04 09:43:43 +01:00
parent a461c6b7fa
commit ca769f2b3d
2 changed files with 126 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
folderPath = "/Volumes/NT-Labor/2024/sioe/High Speed Messungen Oktober/";
% Get list of all files in the folder and subfolders
fileList = dir(fullfile(folderPath, '**', '*'));
% Loop through each file
for i = 1:length(fileList)
% Get the file name and path
oldFileName = fileList(i).name;
oldFilePath = fullfile(fileList(i).folder, oldFileName);
% Skip if its a directory or hidden file
if fileList(i).isdir || startsWith(oldFileName, '.')
continue;
end
ismat = strfind(oldFileName, '.mat');
if ismat
continue;
else
% Find position of last dot (for file extension)
dotIndex = strfind(oldFileName, '.');
% Only proceed if there is more than one dot in the file name
if ~isempty(dotIndex)
% Replace all dots in the "base name" with underscores
sanitizedBaseName = strrep(oldFileName, '.', '_');
% Create the new file name with the corrected extension
newFileName = [sanitizedBaseName, '.mat'];
% Full path of the new file
newFilePath = fullfile(fileList(i).folder, newFileName);
% Rename the file
movefile(oldFilePath, newFilePath);
fprintf('Renamed: %s -> %s\n', oldFilePath, newFilePath);
end
end
end