Delete a file on click of Pushbutton
Mostrar comentarios más antiguos
Hi all !!!!
I have created a GUI(fig). It has one editbox and one pushbutton on it.
I have some dat files like (1.dat, 2.dat, 3.dat etc.).
I want to delete the dat file which is entered in that editbox(like 1,2,3 etc...).
I have written the following code for pushbutton_callback :
delID=get(handles.editDel,’String’);
delete(‘delId.dat’);
but when I click pushbutton, nothing happens….
Please Help ….
Thank You….
Respuestas (1)
Jiro Doke
el 27 de Mzo. de 2011
Try:
delete([delID, '.dat'])
Explanation: delID is a variable that contains character string. To construct the file name, you need to concatenate the variable with '.dat'. When you specify 'del1ID.dat', you're looking for a file called 'del1ID.dat', which you obviously don't have.
Categorías
Más información sobre Simulink en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!