필터 지우기
필터 지우기

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

조회 수: 3 (최근 30일)
Zoe Zhang
Zoe Zhang 2011년 9월 23일
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에서 Data Import from MATLAB에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by