How do I extract only file name from full file name?

40 ビュー (過去 30 日間)
Dong-Gyu Jang
Dong-Gyu Jang 2016 年 3 月 15 日
編集済み: Dong-Gyu Jang 2016 年 3 月 15 日
Hello.
Let's say there is a string "5500ps1.png"
I would like to extract name until comma so outcome from this extraction would be "5500ps1"
How can I do this?
As there are many files, I need to write down code automatically doing this job.
Thanks!

採用された回答

Dong-Gyu Jang
Dong-Gyu Jang 2016 年 3 月 15 日
編集済み: Dong-Gyu Jang 2016 年 3 月 15 日
Oh..I immediately get the answer:)
The function, fileparts, can be used for this process:)
file = 'H:\user4\matlab\myfile.txt';
[pathstr,name,ext] = fileparts(file)
Then the result is
pathstr =
H:\user4\matlab
name =
myfile
ext =
.txt

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeIntroduction to Installation and Licensing についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by