Try this snippet to get a filename of an image or file to read in:
startingFolder = 'C:\Program Files\MATLAB';
if ~exist(startingFolder, 'dir')
startingFolder = pwd;
end
defaultFileName = fullfile(startingFolder, '*.*');
[baseFileName, folder] = uigetfile(defaultFileName, 'Select a file');
if baseFileName == 0
return;
end
fullFileName = fullfile(folder, baseFileName)
Use this snippet to specify a file to save:
startingFolder = userpath
defaultFileName = fullfile(startingFolder, '*.*');
[baseFileName, folder] = uiputfile(defaultFileName, 'Specify a file');
if baseFileName == 0
return;
end
fullFileName = fullfile(folder, baseFileName)
Best Answer