MATLAB: How to delete mat file

deleting

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

Best Answer

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.