where you saved the file upload? using GUI

1 回表示 (過去 30 日間)
Juan Espinoza
Juan Espinoza 2014 年 8 月 6 日
コメント済み: Image Analyst 2014 年 8 月 6 日
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

採用された回答

Image Analyst
Image Analyst 2014 年 8 月 6 日
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)
  1 件のコメント
Image Analyst
Image Analyst 2014 年 8 月 6 日
To save instead of get a filename, use uiputfile() instead of uigetfile():
% Get the name of the file that the user wants to save.
% Note, if you're saving an image you can use imsave() instead of uiputfile().
startingFolder = userpath
defaultFileName = fullfile(startingFolder, '*.*');
[baseFileName, folder] = uiputfile(defaultFileName, 'Specify a file');
if baseFileName == 0
% User clicked the Cancel button.
return;
end
fullFileName = fullfile(folder, baseFileName)

サインインしてコメントする。

その他の回答 (1 件)

Ashish Gudla
Ashish Gudla 2014 年 8 月 6 日
編集済み: Ashish Gudla 2014 年 8 月 6 日
"uigetfile" function returns only the filename and path of the file. It does not upload the file. You can read more about this in the doc page
Once you have the file name and the path (location of the file) you can then use the appropriate file read/write functions depending on the type of file.
  1 件のコメント
Juan Espinoza
Juan Espinoza 2014 年 8 月 6 日
But, how change this path of the file that i need in specific a folder?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMATLAB Report Generator についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by