From Obese Cockroach, 5 Months ago, written in Text.
Embed
  1. folder = int2str(direction);    
  2. d = uigetdir(pwd, 'Select a folder');                                       %select the folder containing all the images
  3. files = dir(fullfile(d, '*.mat'));                                          %Create a structure from that directory of just the .mat files
  4. fprintf( '%d files found \n',size(files,1));                                %Display how many files there are
  5. mkdir(strcat(files(1).folder,'\Disparity Maps\',folder,'\'));
  6.  
  7. for i =1:size(files,1)
  8.     filename = strcat(files(i).folder,'\',files(i).name);                   %Make the file name from the scructure
  9.     result = dispMap(filename,direction,minDisparity, maxDisparity, stepSize);        %get the disparity Map
  10.     savename = strcat(files(i).folder,'\Disparity Maps\',folder,'\Disparity',files(i).name);    %Make a filename to save the result to
  11.     save(savename, 'result');                                                 %Save the file
  12. end