How can i store multiple audio files in a variable ?

2 Ansichten (letzte 30 Tage)
esraa gamal
esraa gamal am 15 Aug. 2022
Kommentiert: Walter Roberson am 15 Aug. 2022
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];

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 15 Aug. 2022
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 Kommentare
esraa gamal
esraa gamal am 15 Aug. 2022
but theey have different number of samples :(
Walter Roberson
Walter Roberson am 15 Aug. 2022
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')

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Audio I/O and Waveform Generation finden Sie in Help Center und File Exchange

Produkte


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by