MATLAB Answers

delete variable file name

48 views (last 30 days)
Martijn Geelen
Martijn Geelen on 15 Apr 2019
Answered: Dennis on 15 Apr 2019
Hi,
In an exception check, i am trying to remove a textfile that has some errors in it (save under .sim). However, its name is variable. 'newname' is the variable name of the file that i would like to remove and is a string type. Can someone tell me how to do this?
if (size(RowsForSKU,1) + row1(1)) > size(C_new,1)
X = ['Long name file order mixed up, therefore, article ',ReadSKU, ' removed with simulation file name ',newname,'.sim'];
disp(X)
%here i would like to delete the variable file name, however the following line does not work
delete 'char(newname).sim';
OmmittedFiles = OmmittedFiles +1;
else
%else do several other this to the file
end

  0 Comments

Sign in to comment.

Accepted Answer

Dennis
Dennis on 15 Apr 2019
Try this:
delete(sprintf('%s.sim',newname))

  0 Comments

Sign in to comment.

More Answers (0)

Sign in to answer this question.


Translated by