How can i store multiple audio files in a variable ?

clc;
clearvars;
close all;
% loading data
load data;
% Normal, Asthma , .., --> that is variable which i used to store audio files in them
overall_dataset =[Normal; Asthma; Pneumonia; BRON; COPD; HeartFailure];

 Accepted Answer

Unless the files are all the same sampling frequency and the same number of samples and the same number of channels, then I recommend
overall_dataset = {Normal; Asthma; Pneumonia; BRON; COPD; HeartFailure};
along with storing the sampling frequency for each in a numeric vector unless you know that they are all the same.

2 Comments

but theey have different number of samples :(
Then use {} like I show. Afterwards you would be able to do things such as
size(overall_dataset{2}, 1)
to find the number of samples for the Asthma dataset.
Depending what you are doing, you might want to instead create a table,
dataset_name = {'Normal'; 'Asthma'; 'Pneumonia'; 'BRON'; 'COPD', 'HeartFailure'};
Data = {Normal; Asthma; Pneumonia; BRON; COPD; HeartFailure};
Frequency = [18000; 12000; 18000; 18000; 36000; 12000];
T = table(Data, Frequency, 'RowNames', dataset_name);
Afterwards you would be able to do things like
T.Frequency('Asthma')

Sign in to comment.

More Answers (0)

Categories

Find more on Signal Processing Toolbox in Help Center and File Exchange

Products

Release

R2020a

Community Treasure Hunt

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

Start Hunting!