MATLAB: Undefined variable “som” or function “som.wave”. in [y, fs, nbits, opts]=wavread(som.wav) function

wavread undefined variable

Hi everyone! I'm trying to use this function [y, fs, nbits, opts]=wavread(som.wav)
but it keeps making that error. "Undefined variable "som" or function "som.wav"." But I don't get it… "som.wav" is a sound file (.wav naturally), and it is in my MATLAB folder with every other m-files on my computer.
Can anyone help me? I'm kind of new with matlab, an this is a homework assignment.
Thanks!

Best Answer

You should input it as a string variable.
[y, fs, nbits, opts]=wavread('som.wav')
And make sure the folder where som.wav is located is on the MATLAB path. You indicate that it is in your post, so just making sure it is a string should work.
Related Question