how to delete mat file

62 visualizaciones (últimos 30 días)
Pat
Pat el 2 de En. de 2013
i have saved a variable by using
save('fp_database.mat','data');
i want to delete this file so i tried
delete('fp_database.mat')
now even i load it by load('fpnn_database.mat');its values are displayed and not deleted
please tell how to delete it
  4 comentarios
Pat
Pat el 2 de En. de 2013
yes i have

Iniciar sesión para comentar.

Respuesta aceptada

Jan
Jan el 2 de En. de 2013
Using Matlab's posibility to search a file in the complete list of folders in the path leads to such strange effects. It is recommended to use absolute file names instead:
File = fullfile(cd, 'fp_database.mat');
save(File,'data');
...
delete(File);
disp(exist(File, 'file'))
The current directory can be modified by GUI or TIMER callbacks, such that absolute file names are more secure in general also.
  2 comentarios
Jan
Jan el 3 de En. de 2013
All that's done inside pwd is calling cd without arguments.

Iniciar sesión para comentar.

Más respuestas (2)

Azzi Abdelmalek
Azzi Abdelmalek el 2 de En. de 2013
Editada: Azzi Abdelmalek el 2 de En. de 2013
Try this
a=1:10;
save('fp_database','a')
delete('fp_database.mat')
clear
load('fp_database')
a

Malcolm Lidierth
Malcolm Lidierth el 2 de En. de 2013
Looks like you have several copies in different folders on the MATLAB path. Delete only deletes the first. Try
which ('fp_database.mat')
after delete to find the 2nd.

Categorías

Más información sobre Search Path en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by