need to delete all mat files from all the folders at the end of execution.

1 view (last 30 days)
Hi, How can I delete all mat file at the end of execution For example my program consists as follows
Function mfile
statement...
function one
DataPath = [pwd '\01_data\001_data\'];
statement...
end
function two
DataPath = [pwd '\02_Data\'];
statement...
end
function three
DataPath = [pwd '\03_Data' '\'];
statement...
end
function four
DataPath = [pwd '\04_Data\'];
statement...
end
function five
statement...
end
end
  • cán anyone help me how to solve this
  1 Comment
Adam
Adam on 24 Sep 2018
Keep track of all the paths and then delete them using
doc delete
It isn't obvious from the code you post what setup you actually have. You just show a bunch of independent functions with no indication how they are called or if they return any arguments. If they don't then they should probably return the DataPath they use to enable you to keep track of it.

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 24 Sep 2018
You should consider using onCleanup()

More Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!