MATLAB: How do i print file names that exist in certain folder in matlab table with out file extension

directory

Dear all..
i'm using the following code to write file names that exist in folder or sub-folder … in matlab table.. but its write these files along with thier extension .. such that if file AA is text file.. then its name in table is AA.txt and so on.. how do i avoid extension in my code.. thanks
projectdir = 'D:\test';
d = dir(fullfile(projectdir, '*'));
files = [];
for subdir = d([d.isdir] & ~ismember({d.name},{'.', '..'}))'
subfiles = dir(fullfile(projectdir, subdir.name, '*.txt'));
[subfiles.folder] = deal(subdir.name);
files = [files; subfiles];
end
details = struct2table(files);

Best Answer

Use fileparts to get the filename without the extensions. Something like this, where C is a cell array of those filenames:
[P,N,E] = cellfun(@fileparts,C,'uni',0)