Skip to content

Instantly share code, notes, and snippets.

@roslovets
Created September 23, 2020 14:27
Show Gist options
  • Save roslovets/90e34d69ed7f540e98fe22d204ba4c1c to your computer and use it in GitHub Desktop.
Save roslovets/90e34d69ed7f540e98fe22d204ba4c1c to your computer and use it in GitHub Desktop.
MATLAB: convinient dir()
function fs = dir2(dpath)
arguments
dpath string = pwd
end
fs = struct2table(dir(dpath), 'AsArray', true);
fs = convertvars(fs, 1:2, 'string');
fs = fs(~ismember(fs.name, ["." ".."]), :);
fs.date = datetime(fs.datenum, 'ConvertFrom', 'datenum');
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment