Display file names from current directory if more than n characters
2 views (last 30 days)
Show older comments
Hi,
I want to write code that returns the filenames in my current directory, but only those filenames with more than n characters.
My code so far:
directory = dir('*.*'); % specifiy files, leave out folders
% remove the two '.' and '..' folders at the top
if length(directory) >= 3
directory = directory(3:end);
end
But how do I select only those filenames with more than n characters? I thought about setting up a logical vector, but I don't know how to do that. Does anybody have any suggestions?
Many thanks,
Dobs
Accepted Answer
More Answers (0)
See Also
Categories
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!