Display just the first letters of a filename as String
조회 수: 11 (최근 30일)
이전 댓글 표시
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
채택된 답변
Ameer Hamza
2020년 6월 18일
편집: Ameer Hamza
2020년 6월 19일
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))
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Characters and Strings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!