說明
示例
file = 'H:\user4\matlab\myfile.txt';
[filepath,name,ext] = fileparts(file)
filepath = 'H:\user4\matlab'
name = 'myfile'
ext = '.txt'
獲取 Linux 的 Dotfile 文件名的組成部分
獲取 Linux® 系統的用戶 .cshrc
文件名的組成部分。
fileparts
將整個文件名解釋為一個擴展名,因為它以句點開頭。
[filepath,name,ext] = fileparts('/home/jsmith/.cshrc')
filepath = '/home/jsmith'
name = 1x0 empty char array
ext = '.cshrc'