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~~~~~~
0 个评论
采纳的回答
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.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!