about import .txt file,how to change special character in its name
2 次查看(过去 30 天)
显示 更早的评论
like Chande.2008052716-17hZCFPF.GY.txt after importing , then the variable name change to Chande_2008052716_17hZCFPF_GY, how to make it,thanks
what i need is deleting the last .txt and changing special symbols like .and - to _, just change the string
0 个评论
采纳的回答
Azzi Abdelmalek
2014-2-13
编辑:Azzi Abdelmalek
2014-2-13
s='Chande.2008052716-17hZCFPF.GY.txt'
s1=strrep(s,'.','_')
s1=strrep(s1,'-','_')
%or
s='Chande.2008052716-17hZCFPF.GY.txt'
s1=regexprep(s,'[-\.]+','_')
3 个评论
Azzi Abdelmalek
2014-2-13
编辑:Azzi Abdelmalek
2014-2-13
You can remove .txt by
s='Chande.2008052716-17hZCFPF.GY.txt'
s1=regexprep(s,'[-\.]+','_')
s1(end-3:end)=[]
更多回答(1 个)
Walter Roberson
2014-2-13
Change how you do the importing.
What is the format of the file? Are there header lines?
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 MuPAD 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!