How do I extract the audiodata from a struct that I got from dir

Illustration
Wynand - 2023-10-23T10:47:33+00:00
Question: How do I extract the audiodata from a struct that I got from dir

I have a folder with 100 wav files I need to iterate through and apply different functions to This is what I have so far   clear % Tester_object = audioread("Recordings\Speaker Female\Eendbekdier\f_ebd_1.wav"); % plot(Tester_object); dir("Recordings\Male Lump\"); audio_files = dir(fullfile("Recordings\Male Lump\", '*.wav')); for i=1:height(audio_files) name = audio_files(i).name; Tester = audioread(name); % This is the line that is not working that I don't know how to fix %-------- Functions applied in this square to 'Tester' % FFT % Frequency spectrum bands % Comparator %-------- These are all sorted end I just need to know how do I get the audiodata from within the struct that is created by dir(fullfile.....Thank you

Expert Answer

Profile picture of John Williams John Williams answered . 2025-11-20

This won't work when you are working with more dynamics folders but this is the solution that I found
 
 
clear
% Tester_object = audioread("Recordings\Speaker Female\Eendbekdier\f_ebd_1.wav");
% plot(Tester_object);

dir("Recordings\Male Lump\");
audio_files = dir(fullfile("Recordings\Male Lump\", '*.wav'))
anemone = audio_files(5).name
x = strcat("Recordings\Male Lump\" + anemone)
Check= audioread(x)

 


Not satisfied with the answer ?? ASK NOW

Get a Free Consultation or a Sample Assignment Review!