Read mix file name from xlsx and saparate mixed files

Hi, everyone i am new here. I want to saprate multiple audio files of male & female from one directory. I have one excel file with 2 coulms file name & Label(male/female). I want to saprate male audio into another directory & female audio as well.. Kindly let me know & share script /code to resolve this issue please.

댓글 수: 1

By using excel file name of audio file, i want to filter mixed male audio & female from same directory.

댓글을 달려면 로그인하십시오.

답변 (1개)

Tejas
Tejas 2024년 12월 27일
편집: Tejas 2024년 12월 27일
Hello Azmat,
It seems that you have a folder containing audio files, along with an Excel sheet that indicates whether each audio file contains either male or female audio, and the goal is to organize these files into separate directories based on gender.
Here are the steps to accomplish this:
audioDir = 'pathToAudioDir';
excelFile = 'pathToExcelFile';
fileTable = readtable(excelFile);
maleDir = fullfile(audioDir, 'male');
femaleDir = fullfile(audioDir, 'female');
mkdir(maleDir);
mkdir(femaleDir);
for i = 1:height(fileTable)
fileName = fileTable.FileName{i}; % Assuming the column name is 'FileName'
label = fileTable.Label{i}; % Assuming the column name is 'Label'
sourceFile = fullfile(audioDir, fileName);
if strcmpi(label, 'male')
destDir = maleDir;
else
destDir = femaleDir;
end
movefile(sourceFile, destDir);
end

카테고리

제품

질문:

2022년 7월 7일

편집:

2024년 12월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by