excel array write error.

thank you. I have another little problem.
I want to print this array, but it gives a constant error.
n=3;
a=1;
for i=1:n
str =int2str(i);
file =strcat(str,'.wav')
%file = sprintf('%ss%d.wav', traindir, i);
%disp(file);
[s, fs] = wavread(file);
v = mfcc(s, fs); % Compute MFCC's
duz=v(:)';
for i=1:14554
h(a,i)=duz(1,i);
xlswrite('z',h);
end
a=a+1;
end

 Risposta accettata

Jan
Jan il 5 Giu 2019
Spostato: Voss il 21 Dic 2023
I've formatted your code today. Please do this by your own using the menu over the sectin for editing the message.
I've mentioned in another thread of you, that your code contains two loops with the same loop counter i. Please consider the given answers, otherwise it is a waste of time to help you.
Whenever you mention an error in the forum, post a copy of the complete error message also. This is more efficient than letting the readers guess, what the error is.
You overwrite the data in the Excel file in all itereations. The matrix h is growing iteratively. There are no comments which explain, what you want to achieve actually. I guess, the following solves the problem:
n = 3;
h = zeros(n, 14554);
for a = 1:n % i ==> a
file = sprintf('%d.wav', a);
[s, fs] = wavread(file);
v = mfcc(s, fs);
h(a, :) = v(1:14554);
end
xlswrite('z.xls', h);
Keep your code as simple as possible.

Più risposte (0)

Categorie

Tag

Richiesto:

il 5 Giu 2019

Spostato:

il 21 Dic 2023

Community Treasure Hunt

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

Start Hunting!

Translated by