I want to exclude a set of file extensions and otherwise list folder contents.
%get filenames in current directory
p = dir(pwd);
p = {p.name};
p = p(1:min(end,20))'
%construct regular expression
%exclude = {'ini','m'}; %just for your convenience
reg = '\.(^ini|m)$';
%actually print file names/paths of files without a certain extension
regexpi(p,reg,'match','once')
This, however, does not work. How can I get the files that exclude these file extensions (last X amount of characters in path)? I tried [^abc]
but this excludes individual characters, which I don't want. Please use regexp or regexprep in your answer