%%\r
% User dialog for the data directory used for files\r
\r
+DirectoryName = get_data_dir();\r
+\r
%DirectoryPath='T:\00-Orvalho\Travnickova\Bubble column\';\r
-DirectoryName = uigetdir(pwd(), 'Select the data folder'); % returns the name and path of the file selected in the dialog box\r
disp(['The data directory used for files is ', DirectoryName]); % displays the name of selected file in Command Window\r
\r
DDirectory = dir(DirectoryName); % Loads directories or subdirectories to struct FFiles(1).name, FFiles(1).folder, FFiles(1).date - i s casem\r
--- /dev/null
+function dir_path = get_data_dir()
+ if (isfile('.last_path'))
+ file_id = fopen('.last_path', 'r');
+ last_path = char(fread(file_id))';
+ fclose(file_id);
+ dir_path = uigetdir(last_path, 'Select the data folder');
+ if ispc
+ fileattrib('.last_path', '-h');
+ end
+ else
+ dir_path = uigetdir(pwd(), 'Select the data folder');
+ end
+
+ if dir_path == 0
+ return
+ end
+
+ file_id = fopen('.last_path', 'w');
+ fprintf(file_id, "%s", dir_path);
+ fclose(file_id);
+ if ispc
+ fileattrib('.last_path', '+h');
+ end
+end