delete variable file name

21 ビュー (過去 30 日間)
Martijn Geelen
Martijn Geelen 2019 年 4 月 15 日
回答済み: Dennis 2019 年 4 月 15 日
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

採用された回答

Dennis
Dennis 2019 年 4 月 15 日
Try this:
delete(sprintf('%s.sim',newname))

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeString Parsing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by