uigetfile for multiple type problem

조회 수: 48 (최근 30일)
Yu Li
Yu Li 2019년 4월 28일
댓글: dpb 2019년 4월 28일
Hi:
I want to use uigetfile to pick files, the files needed have two types:
  1. 'abc*.mat'
  2. '*.dat'
but when I use command:
uigetfile({'abc*.mat','*.dat'})
only the type 'abc*.mat' is shown in the file selection window,
when I use command:
uigetfile({'*.dat','abc*.mat'})
only the type '*.dat' is shown in the file selection window.
these means that, my command only shows the 1st type.
is there any mistake with my command?
Thanks!
Yu

채택된 답변

dpb
dpb 2019년 4월 28일
Gotta' have good eyes in reading the documentation...use
uigetfile({'abc*.mat';'*.dat'})
instead--a column instead of row vector of cell strings. A second column is interpreted as an optional file descriptor.
Also NB: only one selection criterion is active at a time; they're sequential lines in a dropdown box so when you select one, the other goes away. This may or may not be desired behavior. Unfortunately if the latter, even with 'MultiSelect','on' it will cancel the other file in the already selected list so whether having more than one file type in the dropdown box is even worth doing or not appears questionable...
  댓글 수: 8
Walter Roberson
Walter Roberson 2019년 4월 28일
uigetfile() always invokes the system file browser, and only showing one file type at a time is common for system file browsers.
dpb
dpb 2019년 4월 28일
And, uicontrol won't allow the putgetfile style so appears TMW hasn't left any hooks to do anything else.
It seems to me the wrapper function in CVF Fortran let one do that but I've not reinstalled the compiler since the system crash as the installer won't run under 64-bit OS even though the command-line compiler will--but it takes setting a myriad of system variables to make linking work correctly and I've not taken the time to do so, so can't check...and I'm not enough of a masochist to go do it at the root level without the interface functions just for a Forum maybe question that doesn't have direct benefit to the OP! :)
I guess I also wasn't aware of that quirk...seems like a really rude implementation indeed; have to agree w/ Yu on that.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by