LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

??? Error using ==> wavread

Hello there,
I am wondering if there is some matlab user who can help me out a little. Am new to matlab
 
I am working on a matlab project that requires the use of wavread() function to read .wav files and analyze them.
my matlab function is constructed:
    1.  Accept three input parameters
    2.  construct a filename from this 
    3. pick this file from a directory
    4. read the contents of the file into a variable using wavread()
    5. compute average, mean, and variance from the data extracted from the files
see my function code
***********************************************************************************************
function [meanFreq,varFreq] = INTRA_SAMPLE_FREQUENCY_VARIANCE(subjectno,sampleCount,dataset)
%declare local variables
totalFreq = 0;
varFreq=0;
meanFreq=0;
sample=0;
c = 0;
for n=1:sampleCount
    filepath = sprintf('%s_%d_%s',subjectno,n,dataset);
    [sample,fs]= wavread(filepath);
    maxFreq = max(abs(fft(sample)));
   totalFreq = totalFreq + maxFreq;
    c=c+1;

if isequal(n,sampleCount)
    break;
end;
    meanFreq = totalFreq/c
    varFreq = varFreq + (maxFreq - meanFreq)^2
    disp('------------------------------------------------------------------')

end;
**************************************************************************************************
My problems are
    1. when i run this code, it outputs correct values (for sample, maxFreq,totalFreq which means it extracted from the .wav file)  however, at the end of the results it reports  ??? Error using ==> wavread!!! 
    2. Secondly, i only need the function to print/return the meanFreq, and varFreq values. When i move the code computing these values outside of the for loop, it fails to return any value at all!

I have been on it for the better part of 2 days. ANY HELP WOULD BE APPRECIATED!!!

0 Kudos
Message 1 of 3
(3,339 Views)

wow!

Where is the helping spirit that existed among developers on the internet some time back. Not a single help from 60 views.

Beautiful.

0 Kudos
Message 2 of 3
(3,279 Views)
In case you didn't realize it, you posted to a LabVIEW board - not a matlab one. While there are certainly some matlab users here, you would probably get a better response if you found a dedicated matlab forum.
Message 3 of 3
(3,274 Views)