From: Dilip Gopalakrishna on 24 Feb 2010 05:26 Hello, I seek help in accessing files with a particular extension using the dir command. However, I intend to use a variable name inside the dir command instead of explicitly mentioning the path name. Here is the reference code: Dirname = uigetdir('C:\Documents\MATLAB\TempFolder'); directory = dir(Dirname); Line 2 gives all files in the directory accessed by the variable name 'Dirname'. However, to selectively extract say only .m files, I cannot use the '*.m' wildcard operator as follows: directory = dir(Dirname *.m); This is a line parse error. Did not find help with regard to this in documentation too. How do I use the wildcard operator in this case?
From: Oleg Komarov on 24 Feb 2010 07:08 "Dilip Gopalakrishna" <jeedilip(a)yahoo.co.in> wrote in message <hm2urv$sv9$1(a)fred.mathworks.com>... > Hello, > I seek help in accessing files with a particular extension using the dir command. However, I intend to use a variable name inside the dir command instead of explicitly mentioning the path name. Here is the reference code: > > Dirname = uigetdir('C:\Documents\MATLAB\TempFolder'); > directory = dir(Dirname); > > Line 2 gives all files in the directory accessed by the variable name 'Dirname'. > However, to selectively extract say only .m files, I cannot use the '*.m' wildcard operator as follows: > directory = dir(Dirname *.m); > This is a line parse error. > Did not find help with regard to this in documentation too. > How do I use the wildcard operator in this case? You forgot the backslash at the end of dirname. Oleg
From: Doug Schwarz on 24 Feb 2010 07:58 In article <hm2urv$sv9$1(a)fred.mathworks.com>, "Dilip Gopalakrishna" <jeedilip(a)yahoo.co.in> wrote: > Hello, > I seek help in accessing files with a particular extension using the dir > command. However, I intend to use a variable name inside the dir command > instead of explicitly mentioning the path name. Here is the reference code: > > Dirname = uigetdir('C:\Documents\MATLAB\TempFolder'); > directory = dir(Dirname); > > Line 2 gives all files in the directory accessed by the variable name > 'Dirname'. > However, to selectively extract say only .m files, I cannot use the '*.m' > wildcard operator as follows: > directory = dir(Dirname *.m); > This is a line parse error. > Did not find help with regard to this in documentation too. > How do I use the wildcard operator in this case? Dirname = uigetdir('C:\Documents\MATLAB\TempFolder'); pattern = fullfile(Dirname,'*.m'); directory = dir(pattern); -- Doug Schwarz dmschwarz&ieee,org Make obvious changes to get real email address.
|
Pages: 1 Prev: video extention Next: GUI: creating and deleting buttons interactively? |