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
I would appreciate your prompt response.

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;
    % 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.
    fullFileName = fullfile(folder, baseFileName)