From eludlam@mathworks.com Tue Sep 29 15:01:18 1998
Newsgroups: comp.soft-sys.matlab
Subject: Re: uigetfile filter
From: Eric Ludlam <eludlam@mathworks.com>
Date: 29 Sep 1998 16:01:18 -0400

"Steve Johnson" <sj@asitinc.com> writes:
> perhaps this is just system-dependent, but on a wintel machine:
> 
> [file, path]=uigetfile('*.a; *.b; *.c','Open Data File');
> 
> pops up the standard gui w/all *.a, *.b and *.c files in the window.
> 
> on unix nothing appears, apparently because the system treats the filter
> string as one string and not 3.  seems as tho on unix only one
> filterspec can be used.

Hi,

  The dilemma here is that the capabilities of the built in file
selection dialogs on windows and unix are different.  The PC dialog
was able to handle all those filters with the built in dialog.  Unix,
on the other hand, does not handle "multiple filters" in that way.
For example, on unix, you should be able to say '*.[abc]' to
accommodate the same behavior for the above example.  If you have
multiple character extensions, it gets a little tricker, but it can be
done.  On the PC you would say:

  '*.mat; *.tar'

On unix, you would instead say:

  '*.(mat|tar)'  or '(*.mat|*.tar)'

to get the same behavior.  (I tested this on Solaris)

In brief, you need to use platform specific wild carding because you
are using platform specific file selectors.  You can lookup the
"regcmp" command with man to see about some of the regular expression
matching that is available.

Good Luck
Eric

ps. Motif explicitly converts the file globbing symbols . ? and * into
    things that can be used by the regex command.  You can, of course,
    use standard regex commands such as (), and |, as shown above, but
    they are not standard command line globbing symbols.  To do the
    same thing on the command line, you would say: '*.{mat,tar}'
-- 
[====]___||.   Eric Ludlam          "The X Guy"    The MathWorks   x 7556
  |[]|     |=  eludlam@mathworks.com  (work)      http://www.mathworks.com
 _|__|=====+   zappo@ultranet.com     (home)   http://www.ultranet.com/~zappo
   O-O-O[ ]\\  	        `Go Throw A Rock!' - Hudson Trebuchet Crew

