select all .xls files together and read one by one( without naming .xls file in a specified name)
1 view (last 30 days)
Show older comments
in a folder there are several .xls files and name of these aren't specified. it's needed by selecting 1 or 2 or 3 or ever other numbers of those, one by on has been read by MATLAB and then display this message fprint'filename.xls checked' for example:these files are in folder: a.xls, as.xls, lku.xls, fd.xls,... after reading each one, matlab show message about that, 'like:a.xls checked'
my opinion:
cd(path of the folder);
put names of all files in a matrix like r
for i=1:size(r,1)
[dfile,pathname]=uigetfile('*.xls','Select Data File');
f = xlsread(dfile(1,i))
func(f)%%func is a function that do something on f and give some outputs
fprint'filename.xls checked'
end
thanks a lot
0 Comments
Accepted Answer
bym
on 3 Sep 2011
d = dir('*.xls');
for k = 1:numel(d)
%open file & do stuff here
fprintf('%s\tchecked\n',d(k).name)
end
3 Comments
Fangjun Jiang
on 3 Sep 2011
If you want to print a '\' symbol, you need to specify it as fprintf('\\')
More Answers (0)
See Also
Categories
Find more on File Operations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!