Which is better to use in my case -uigetfile or uigetdir?

7 Ansichten (letzte 30 Tage)
Ashish
Ashish am 24 Jun. 2014
Bearbeitet: Ashish am 24 Jun. 2014
I have a archived files in the following location- C:\Archive\project_dir\project_folder.
I have a Browse button in the GUI, which should allow to choose the entire project folder (It consists of .mat files). Which command is better for my requirement, uigetfile or uigetdir?
Note: Also, I need to have a check if the user has selected the file within the folder C:\Archive\project_dir. It is not possible to select the project_folder outside this directory location.

Akzeptierte Antwort

Azzi Abdelmalek
Azzi Abdelmalek am 24 Jun. 2014
f='C:\Archive\project_dir\project_folder\'
[file,pat]=uigetfile(f,'*.mat')
yourfile=fullfile(pat,file)
test=isequal(f,pat) % to check if the user has selected the right folder
  1 Kommentar
Ashish
Ashish am 24 Jun. 2014
Bearbeitet: Ashish am 24 Jun. 2014
Thanks Azzi.
Actually, I have to select the project folder and not the .mat files within. When running the code, I am not able to select the entire folder!
Can you suggest a solution?

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Dialog Boxes finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by