function save_dir = check_folder(save_path)

%CHECK_FOLDER checks for the existence of a folder with a given name
% CHECK_FOLDER checks for the availability of a given folder name and outputs
% a string containing the path to the appropriate folder. Creates the folder
% if it doesn't exist.

% Inputs:
%   save_path - initial string containing the name of the target folder

% Outputs:
%   save_dir - string containing the path to the found/created directory

if not(isfolder(save_path))
       mkdir(save_path)
       save_dir = save_path;
elseif isfolder(save_path)
    save_dir=save_path;

end
end

