MATLAB: How can I appropriately get a for loop to extract wav files to sub folders(directories)?

catenatefor loopMATLABstrfind

My currrent issue is trying to take a folder with 40 .wav files, (10s clips for each instrument that add up to 40s total)
but all are labeled, "01_composer_basson", "01_composer_violin"……"02_composer_basson"….and so on
I cannot seem to write a for loop properly to get all the 10s clips for each .wav into each of their own directories.
I can then break them up and anaylize them by cattinizing them.
How can i fix my loop so i can get each instrument .wav file to the directory?
i have this so far, i apologize in advanced for my lack of matlab skills!
%extracts the audio files from the main folder and puts them into folders
%based on their name.....
function [] = AudioExtract()
File = ls('\\users\audio_stems\');
%folders for seperate instruments
mkdir Basson
mkdir Saxphone
mkdir Clarinet
mkdir Violin
% the original folder all the files are in has 40 .wav files
%10 for each instrumnet
for i=1:42
% first reaults are a . then a ..(
if(File(i,3) ~= '_')
continue
else
if mod(i,3)==0
disp('.');
end
if (strfind(File(1,:), 'basson') ~= 0)
Intsrument = 'Basson';
else
(strfind(File(1,:), 'clarinet') ~=0);
Intrsrument = 'Carinet';
if (strfind(File(1,:), 'saxaphone') ~= 0)
Instrument='Saxaphone';

Best Answer

List = dir('\\users\audio_stems\*.wav');
%folders for seperate instruments
mkdir Basson
mkdir Saxphone
mkdir Clarinet
mkdir Violin
for k = 1:numel(List)
Name = List(k).name;
if contains(Name, 'bassson')
Intsrument = 'Basson';
elseif contains(Name, 'clarinet')
Intsrument = 'Basson';
... etc
end
movefile(Name, fullfile(Instrument, Name));
end