Reputation: 37
I want to delete a file with variables in the file name. But MATLAB doesn't seem to recognize the file name when using delete
. Can anyone help me?
ratio=1;
a=2;
nameoffile3=['r' num2str(ratio) '_a' num2str(a) '.txt'];
delete nameoffile3
Upvotes: 1
Views: 372
Reputation: 19689
To delete a file whose name is given by a character array, use delete
with parenthesis ()
i.e.
delete(nameoffile3)
Upvotes: 1