Display just the first letters of a filename as String
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Niklas Reinshagen
am 18 Jun. 2020
Kommentiert: Niklas Reinshagen
am 21 Jun. 2020
Hey I wan't to display just the first four letters from the file... lets say: TestFile_18.06.2020.txt so Matlab displays just "Test".
Is there any short possibility to make this happen? It should be integraded into a script later.
Best Regards
Niklas
0 Kommentare
Akzeptierte Antwort
Ameer Hamza
am 18 Jun. 2020
Bearbeitet: Ameer Hamza
am 19 Jun. 2020
If it is stored in a variable as a char array, then you can simply use indexing
x = 'TestFile_18.06.2020.txt';
disp(x(1:4))
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu File Operations 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!