fileparts関数はいかがでしょうか。
file = 'H:\user4\matlab\myfile.txt'
[filepath,name,ext] = fileparts(file)
% 以下出力
% filepath = 'H:\user4\matlab'
% name = 'myfile'
% ext = '.txt'
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!