Delete documents before strarting the routine

9 views (last 30 days)
My Matlab script creates three different documents (.txt documents and .xlsx document). Every time I run the script I have to erase those documents manually in order to avoid problems. Does someone know a "script" which will go at the beginning of my routine that will delete such documents before running the analysis? Thanks.

Accepted Answer

Jan
Jan on 13 Mar 2017
Do tis for the wanted files:
if exist(FileName, 'file') == 2
delete(FileName);
end
  7 Comments

Sign in to comment.

More Answers (0)

Categories

Find more on Construct and Work with Object Arrays 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!