MATLAB Answers

1

UI get file or dirrectory

Adam 님이 질문을 제출함. 12 Nov 2012
Is there a command similar to, or a way to utilize either uigetfile, or uigetdir that allows a user to select either a file OR a directory and not just one or the other?
e.g. i have a function which will parse/import an entier directory, or individually specified files and i would like a UI window which allows the user to select individual files to be imported or a directory to be imported.

  댓글 수: 0

로그인 to comment.

답변 수: 1

Answer by Azzi Abdelmalek
on 12 Nov 2012
Edited by Azzi Abdelmalek
on 12 Nov 2012

[file,folder]=uigetfile
if you want to have a file name with its path
fic=fullfile(folder,file)

  댓글 수: 2

Adam
on 12 Nov 2012
The 'uigetfile' function allows a user to select a file(s) and outputs the file name and the folder in which it resides. It does not however allow for a user to select a folder on its own.
Azzi Abdelmalek
on 12 Nov 2012
The use uigetdir. If you want him to choose add a code like this
str ={'select file','select folder'}
s = listdlg('PromptString','Select a file:','SelectionMode','single','ListString',str)
if s==1
[file,folder]=uigetfile
else
folder=uigetdir
end

로그인 to comment.



Translated by