MATLAB Answers

"Unrecognized function or variable 'filename'. Error in audioread (line 82) filename = convertStr​ingsToChar​s(filename​);'

9 views (last 30 days)
Marsha Groen
Marsha Groen on 24 Jul 2021
Commented: Jan on 26 Jul 2021
I am building the MIT Radar course, where you can download the doppler files. With the Doppler Files is a .wav file. I typed in
[Y, FS]= audioread('Off of Newton Exit 17.wav');
because this contains both variable values. I ran this last night and it worked. But I woke up this morning to run it again and it keeps giving me this 'Unrecognized function or variable 'filename' error. I tried using convertStringsToChars('Off of Newton Exit 17.wav') which it goes through, but it doesn't pull the variables like I need it to. it returns to the same error. I have tried changing the location, I have taken the entire address out of the audioread. Nothing has worked yet.
I looked up the error advising that the parsen is <0... I am absolutely stuck. Any help would be great. Thank you

Answers (2)

Jan
Jan on 24 Jul 2021
Edited: Jan on 24 Jul 2021
Your variable "info" is a struct, not a char vector or string.
info = audioinfo('Off of Newton Exit 17.wav');
[Y, FS] = audioread(info.Filename);
Under Matlab R2018b your code fails also, but with a different error message.
  8 Comments
Jan
Jan on 25 Jul 2021
@Marsha Groen: Please post code as text and not as screen shots.
I asked you to copy my code carfully.
% My code:
info = audioinfo('Off of Newton Exit 17.wav');
% Your code
info = audioinfo('Off of Newton Exit 17.wav ');
% ^ additional space
Your code should fail with the error message:
% Error using audioinfo (line 51)
% The filename specified was not found in the MATLAB path.
Trailing spaces are not allowed for file names under Windows.
You have tried a lot of versions, which contain a variety of typos:
[data, FS] = audioinfo('Off of Newton Exit 17.wav');
[data, FS] = audioread('info');
[data, FS] = audioinfo(info;
[data, FS] = audioinfo(info);
[Y, FS] = audioread(info.Off of Newton Exit 17.wav);
info = audioinfo('Off of Newton Exit 17.wav ');
function [y,Fs] = audioread('Off of Newton Exit 17.wav', double);
[Y, FS] = audioread;
Programming languages are very susceptible for inserting some characters at the wrong locations. You have to crae for writing exactly want is needed. There is not fuzzy logic, which tries to fix such typos automagically.

Sign in to comment.


Jan
Jan on 25 Jul 2021
Edited: Jan on 25 Jul 2021
A very bold guess:
Are you working with admin privileges? Did you open the file audioread.m and overwrite the first line of code, which should be
function [y,Fs] = audioread(filename, range, datatype)
How does the function start on your computer?
edit audioread
  8 Comments
Jan
Jan on 26 Jul 2021
You are welcome. Matlab problems are the purpose of this forum. The harder the problem, the more useful is the help. :-)

Sign in to comment.

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by