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

W
Wynand · Oct 23, 2023 · 2K views
Question
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 PhD Expert
Answered Aug 14, 2026
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)

 

100% Run Guarantee 3-Hour Fast-Track Delivery

Need a Custom Version or Complete Simulation for This Problem?

Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.

Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!