I have attached the sample file. Kindly help me to resolve the problem

2 commentaires

KSSV
KSSV le 10 Juil 2019
Load the data using csvread/xlsread/readtable
Pick the required column and use sound
Anu G
Anu G le 10 Juil 2019
This is the code i used. i am getting error as defined function or variable 'y'.
T=readtable('2khz.csv');
% ^^^^^^^^^------ your csv filename
p=T{:,1};
q=T{:,2};
r=T{:,3};
s=T{:,4};
t=T{:,5};
u=T{:,6};
save('mymat.mat','p','q','r','s','t','u')
load mymat.mat
filename='mymat.wav';
Fs=6000;
audiowrite('mymat.wav',y,Fs);
clear y Fs
[y,Fs]=audioread(filename);
sound(y,Fs);

Connectez-vous pour commenter.

 Réponse acceptée

Star Strider
Star Strider le 10 Juil 2019
Using numbered variables is never a good idea.
Do this instead:
T=readtable('2khz.csv');
A = table2array(T(:,3:8));
Then, in the save call, add ‘Fs’:
Fs=6000;
save('mymat.mat','Fs','A')
You can then use audiowrite with the matrix:
audiowrite('mymat.wav',A,Fs);
You can import all your data with audioread, however sound will only work with at most two channels:
[y,Fs]=audioread('mymat.wav');
sound(y(:,3:4),Fs);
for example.

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by