Created
November 21, 2018 09:25
-
-
Save robertoostenveld/d3400ae756098138532a65f75133de18 to your computer and use it in GitHub Desktop.
MATLAB function to truncate the content of a file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function truncate(filename) | |
% TRUNCATE a file to 0 bytes, i.e. replace the file with an empty one | |
% | |
% Use as | |
% truncate(filename) | |
assert(exist(filename,'file'), 'file does not exists'); | |
fid = fopen(filename, 'w'); | |
fclose(fid); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment