Skip to content

Instantly share code, notes, and snippets.

@knkumar
Forked from sajith/loadtimes.m
Created May 17, 2012 20:08
Show Gist options
  • Save knkumar/2721296 to your computer and use it in GitHub Desktop.
Save knkumar/2721296 to your computer and use it in GitHub Desktop.
silly function to show load times of .mat files under a directory
function loadtimes ( dirname )
if isempty ( dirname ), return, end
x = '$(NF)","$5';
cmd = sprintf ( 'find %s -iname *.mat | xargs -I {} sh -c "ls -lh {}" | awk ''{print $NF","$5}'' > loadtimes.csv', dirname );
system ( cmd );
fhandle = fopen('loadtimes.csv','rt');
csv_cell = textscan(fhandle,'%s %s','Delimiter',',');
mfiles = csv_cell{1,1};
mfsize = csv_cell{1,2};
for i = 1 : length(mfiles)
fname = sprintf ( '%s', mfiles{i});
fsize = sprintf ( '%s', mfsize{i});
fprintf ( '%-30s : %10s : \t', fname, fsize );
tic; load ( fname ); toc;
end
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment