MATLAB: Where you saved the file upload? using GUI

fileguiloadmatlab guipath

I'm making a guide in Matlab and I have some problems for Load Data!
I want know where they are saved? because i need this file in a specific folder.
[FileName Path]=uigetfile('*.dat','BatimetrĂ­a');
if FileName == 0
return
end
I would appreciate your prompt response.
Regards

Best Answer

  • Study this snippet of code:
    % Have user browse for a file, from a specified "starting folder."
    % For convenience in browsing, set a starting folder from which to browse.
    startingFolder = 'C:\Program Files\MATLAB';
    if ~exist(startingFolder, 'dir')
    % If that folder doesn't exist, just start in the current folder.
    startingFolder = pwd;
    end
    % Get the name of the file that the user wants to use.
    defaultFileName = fullfile(startingFolder, '*.*');
    [baseFileName, folder] = uigetfile(defaultFileName, 'Select a file');
    if baseFileName == 0
    % User clicked the Cancel button.
    return;
    end
    fullFileName = fullfile(folder, baseFileName)