How to delete 'mat 'files
20 views (last 30 days)
Show older comments
Commented: sri Jagarlmudi on 18 Sep 2018
Hi, I have 20 files with '.dat' and '.mat' extension in one folder. And I have problem with deleting files with extension '.mat'. I have written this in order to delete mat files
after deleting one '.mat ' it showing error
Error using delete
Argument must contain a string.
Error in myfile(line 81)
Can any one please tell me how to solve this problem
MF on 18 Sep 2018
Edited: MF on 18 Sep 2018
OCDER on 18 Sep 2018
DataPath = 'C:\Blah\User\Blah';
More Answers (1)
Steven Lord on 18 Sep 2018
I would be extremely surprised (stunned) if that worked. The any function returns a logical value, so what you're running is:
delete(true) % or
If you want to delete ALL the files with the .mat extension in that subdirectory, see the first example on the delete documentation page. If you want to delete some of the files, explain in more detail (in words, not code) what you want to do and we may be able to help you do that.
Find more on Entering Commands 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!