How do I add these files to my loop?

조회 수: 4 (최근 30일)
Fatemah Ebrahim
Fatemah Ebrahim 2020년 6월 18일
답변: Image Analyst 2020년 6월 18일
I have multiple files and I only want my Excel files added to the directory.
myDir = uigetdir('path'); %gets directory
myFiles = dir(fullfile(myDir));
M(length(myFiles),s)=zeros; %gets all wav files in struct
for k = 1:length(myFiles)
baseFileName = myFiles(k).name;
fullFileName = fullfile(myDir, baseFileName);
A = readmatrix(fullFileName,'Whitespace',' []');
end

답변 (1개)

Image Analyst
Image Analyst 2020년 6월 18일
Try this:
filePattern = fullfile(myDir, '*.xls*');
myFiles = dir(filePattern);

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by