Random number in a file name, how to automate xlsread?

3 次查看(过去 30 天)
I would like to automate reading excel files into matlab.
And the file name is like: name_21-Sep-2011-12345678.xls
So basically I get one file from broker every day, and I could handle the date part in the file name, but then somehow the broker add a random number at the end of the file name which changes every day. So I need to know how to read this file using xlsread? How to handle the xxx part which is the random number?
filename = ['name_',datestr(datenum(today),'dd-mmm-yyyy'),xxx,'.xls']
Thanks a lot~~~~~~

采纳的回答

Fangjun Jiang
Fangjun Jiang 2011-9-23
If you know the file name partially, you can do this.
File=dir('name_21-Sep-2011-*.xls');
Hopefully, there is only one matched file, then you can do:
FileName=File(1).name
If it returns multiple files, then you need to find a way to narrow it down.
  1 个评论
Zoe Zhang
Zoe Zhang 2011-9-23
I never used dir before :-0
I think that will work since the date is enough to narrow down to one file, thanks a lot~~~

请先登录,再进行评论。

更多回答(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