how to get files name without format extension inside a folder
조회 수: 7 (최근 30일)
이전 댓글 표시
i have a folder with many files with different extension.i need .txt format files name alone to be saved in a variable in matlab?
댓글 수: 0
답변 (1개)
ES
2014년 1월 16일
allTextFiles=dir('*.txt');;
number_of_files=length(allTextFiles);
Name_ofFile_1=allTextFiles(1).name;...
댓글 수: 3
ES
2014년 1월 16일
The variable you have used "nameoffile" can hold only one string. So when the for loop finishes, it will have the last filename only.. Use a cell instead.
path = 'C:\Users\test\';
listing = dir(fullfile(path, '*.txt'));
nof=length(listing);
for i=1:numel(listing)
nameoffile{i}=listing(i).name;
end
참고 항목
카테고리
Help Center 및 File Exchange에서 Whos에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!