Prev: Plot data and dates
Next: Free Matlab Figure Viewer
From: Matthias on 3 Aug 2010 13:04 Hello, I need to automatically load many files whose filenames have a date (MMDDYY) in the end. Some files might be replaced later on by other files with a different date only. e.g. a_b_c_d_111709 will be replaced by: a_b_c_d_080310 I need to keep opening the file regardless of the date in the end of the filename. Any ideas how can I use "load" or any other command to do this? Thanks,
From: us on 3 Aug 2010 13:23 "Matthias " <mstaupitz(a)gmail.com> wrote in message <i39i64$dej$1(a)fred.mathworks.com>... > Hello, > > I need to automatically load many files whose filenames have a date (MMDDYY) in the end. Some files might be replaced later on by other files with a different date only. e.g. > > a_b_c_d_111709 will be replaced by: > a_b_c_d_080310 > > I need to keep opening the file regardless of the date in the end of the filename. Any ideas how can I use "load" or any other command to do this? > > Thanks, a hint: help dir; us
From: omegayen on 3 Aug 2010 13:31 "us " <us(a)neurol.unizh.ch> wrote in message <i39j9p$pkm$1(a)fred.mathworks.com>... > "Matthias " <mstaupitz(a)gmail.com> wrote in message <i39i64$dej$1(a)fred.mathworks.com>... > > Hello, > > > > I need to automatically load many files whose filenames have a date (MMDDYY) in the end. Some files might be replaced later on by other files with a different date only. e.g. > > > > a_b_c_d_111709 will be replaced by: > > a_b_c_d_080310 > > > > I need to keep opening the file regardless of the date in the end of the filename. Any ideas how can I use "load" or any other command to do this? > > > > Thanks, > > a hint: > > help dir; > > us You use dir along with a wildcard * something like loadedFiles = dir('*.dat') then you might need a few more lines to read in each file individually depending on file type
From: Steven_Lord on 3 Aug 2010 15:40 "Matthias " <mstaupitz(a)gmail.com> wrote in message news:i39i64$dej$1(a)fred.mathworks.com... > Hello, > > I need to automatically load many files whose filenames have a date > (MMDDYY) in the end. Some files might be replaced later on by other files > with a different date only. e.g. > > a_b_c_d_111709 will be replaced by: > a_b_c_d_080310 > > I need to keep opening the file regardless of the date in the end of the > filename. Any ideas how can I use "load" or any other command to do this? See question 4.12 in the newsgroup FAQ. -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ To contact Technical Support use the Contact Us link on http://www.mathworks.com
From: Matthias on 3 Aug 2010 16:59 Thanks guys, I came up with a solution using regexpi: locat = uigetdir('','Select the folder where the files are'); filenames = dir([locat '/*.mat']); aux = numel(filenames); filenames = struct2cell(filenames); filenames = filenames(1,1:aux); % ftarg = target file for i = 1 : aux fdir = char(filenames(i)); fdir = fdir(1:regexpi(fdir,'|.mat')-1); x = regexpi(fdir,'\d+'); x = max(x); dmdate = fdir(x:end); fdir = fdir(1:x-1); if strcmpi(ftarg,fdir) == 1 return end end thx
|
Pages: 1 Prev: Plot data and dates Next: Free Matlab Figure Viewer |