Skip to content

Instantly share code, notes, and snippets.

@MichaelTr7
Last active April 8, 2021 18:33
Show Gist options
  • Save MichaelTr7/a24d6717d5b6c94121cef41409f0f5a3 to your computer and use it in GitHub Desktop.
Save MichaelTr7/a24d6717d5b6c94121cef41409f0f5a3 to your computer and use it in GitHub Desktop.
A MATLAB Script for Loading MAT files from folders.
Folder_Directory = "";
MAT_Files = dir(fullfile(Folder_Directory,"*.mat"));
for File_Number = 1: length(MAT_Files)
load(fullfile(Folder_Directory,MAT_Files(File_Number).name));
end
@MichaelTr7
Copy link
Author

The Folder_Directory variable is the path to your folder holding the .mat files that are trying to be loaded. If left as Folder_Directory = ""; the current working directory will be used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment