Use dir with a defined string AND wildcard?
32 次查看(过去 30 天)
显示 更早的评论
I am trying to search through roughly 2000 .csv files to find the one that matches user input. The user input is in the form of a string, so I have a string 'R' that I want to include in my DIR search. I also want to use the wildcard '*' in the DIR function because the file names are much more complex than the user input 'R'. Is there a way to search my files using both a predefined string 'R' and wildcard? I know I could use a string and wildcard together in the form DIR('*filesearch'), but I want to utilize user input from a GUI rather than have the user go into the code and include their search words explicitly in the DIR function.
0 个评论
采纳的回答
the cyclist
2017-5-24
编辑:the cyclist
2017-5-24
Is it as simple as
R = 'user_stuff'; % Get this from user input
dir(['*',R])
or maybe
dir(['*',R,'*'])
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 File Operations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!