I want to load a folder of .mat files into the workspace of Matlab so that I don't need to manually load them one by one...
Asked
Active
Viewed 1,445 times
3 Answers
0
I can recommend the following: http://www.mathworks.com/matlabcentral/fileexchange/10867-uipickfiles--uigetfile-on-steroids
This tool enables you to select not only one folder, but also multiple folders/files in different directories.

C.Colden
- 627
- 1
- 8
- 28
0
I wrote this to import all files in a folder and be able to cycle through them.
function FileCycle
PathSets = 'P:\MAL Archive\Movies\2014_09_30\';
List = dir([PathSets '*.mp4']);
clear f;
for i = 1:length(List)
clear S;
load([PathSets List(i).name]);
f(i)= S;
end

jack
- 106
- 9
-1
You can use the addpath(folderName)
function to add the folder you want to the top of the search path, this should give you access to whatever .mat files are in the included folder. To learn the syntax help addpath
in matlab should give you all you need to know.

HoneyBadger17
- 21
- 4
-
Adding a path to the search path doesn't solve the problem. They need to also import the MAT files too into the workspace. You've probably only made it slightly easier to do the work. – rayryeng Mar 10 '15 at 16:21