Movefile with variable file names

조회 수: 12 (최근 30일)
gosox2017
gosox2017 2017년 3월 20일
댓글: gosox2017 2017년 3월 20일
After an excel file is pulled from a webpage it saves to my downloads. I want to pull this file into a different folder and then run readtable(). My issue is the file has a date in it so the file name changes every day. Is there a way to use a variable filename in a path in a movefile call? ie. d = datetime('today','format','MM-dd-yyyy'); fileName = strcat('Stock List(',char(d),').xls'); movefile user\blah\downloads/(fileName) users\blah\destination
If this doesn't work how can I use readtable with a path to the file. xlsread() messes with the tables formatting. Thanks!

채택된 답변

Adam
Adam 2017년 3월 20일
편집: Adam 2017년 3월 20일
Use the function syntax of movefile to use a variable...
movefile( source, destination );
  댓글 수: 1
gosox2017
gosox2017 2017년 3월 20일
Awesome, thanks Adam! That works great!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Files and Folders에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by