about import .txt file,how to change special character in its name
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Roger
am 13 Feb. 2014
Bearbeitet: Azzi Abdelmalek
am 13 Feb. 2014
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 Kommentare
Akzeptierte Antwort
Azzi Abdelmalek
am 13 Feb. 2014
Bearbeitet: Azzi Abdelmalek
am 13 Feb. 2014
s='Chande.2008052716-17hZCFPF.GY.txt'
s1=strrep(s,'.','_')
s1=strrep(s1,'-','_')
%or
s='Chande.2008052716-17hZCFPF.GY.txt'
s1=regexprep(s,'[-\.]+','_')
3 Kommentare
Azzi Abdelmalek
am 13 Feb. 2014
Bearbeitet: Azzi Abdelmalek
am 13 Feb. 2014
You can remove .txt by
s='Chande.2008052716-17hZCFPF.GY.txt'
s1=regexprep(s,'[-\.]+','_')
s1(end-3:end)=[]
Weitere Antworten (1)
Walter Roberson
am 13 Feb. 2014
Change how you do the importing.
What is the format of the file? Are there header lines?
Siehe auch
Kategorien
Mehr zu MuPAD finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!