??? Undefined function or method 'FFT ' for input arguments of type 'char'.
Show older comments
Heeeeey everyone,
My question is pretty general. I keep getting the following error when I try to run my simulation:
??? Undefined function or method 'FFT' for input arguments of type 'char'.
I am not sure why I am getting this error, as I am not explicitly calling on the FFT function. I did some background reading on this error type and found out that it has to do with specifying the correct path name.
The thing is, I am calling a user defined function called "fft1", which is an "altered" version of the discrete fourier transform. fft1 uses the actual fft function that is provided by MATLAB.
Can anyone help me fix my problem? I feel like I have set the path correctly, but I continue to get this error. Does it have something to do with my fft1 function?
Thanks,
Sarah
Accepted Answer
More Answers (4)
Walter Roberson
on 10 Oct 2011
This would probably not be caused by incorrect path names. It would be caused by trying to pass a string in to MATLAB's fft() routine as the data to be fft'd.
We do not have enough information about what fft1 does or how you are calling it in order to determine how the string got there. Kevin's suggestion to use the debugger is a good one: command
dbstop if error
and then run your program, and it will stop at the line that was the problem.
5 Comments
Sarah
on 10 Oct 2011
Walter Roberson
on 10 Oct 2011
Question: is your file "fft1.m" or "fft 1.m" with a space between the fft and the 1 ? No spaces allowed in the name.
If you do indeed have a space, then
[f,y] = fft 1[x,dt,KW]
would be treated as a call to fft() with an argument string of '1[x,dt,KW]'
Note to that [] is list building in MATLAB, not function calling.
Try that dbstop if error and see where it ends up, and then copy that exact line here and report the class() of each variable the code is passing in.
Sarah
on 10 Oct 2011
Sarah
on 10 Oct 2011
Sarah
on 10 Oct 2011
Iman Alsharkawi
on 10 Oct 2011
0 votes
Make sure that fft1.m is either in the same directory you are working in or in one of the folders that is in your path.
8 Comments
Sarah
on 10 Oct 2011
Kevin
on 10 Oct 2011
You do not need to add a main matlab path, it should be able to find fft() without any direction.
It sounds like your inputs to fft() are screwed up. Put a stop on the function fft() and run it. Then check your inputs are not strings. xlsread may have made something a string without you knowing.
Wayne King
on 10 Oct 2011
I agree with Kevin and Walter, sounds like your fft1() function is trying pass fft() something like fft('abc')
Sarah
on 10 Oct 2011
Sarah
on 10 Oct 2011
Wayne King
on 10 Oct 2011
when it opens the editor at that line:
y = fft(x);
point your cursor at the x and tell us what it says, or go back to your command window and enter:
K>>whos x
Kevin
on 10 Oct 2011
The way I debug is:
Open the .m file that is calling fft() and go to that line in the .m file.
Next to the line number on the left, there is a line that looks like " - ". Click there, and a red dot should appear next to the line of code.
Then run your file, and it will pause at that line. Once it pauses, you can see exactly what your input variables are.
Sarah
on 10 Oct 2011
Iman Alsharkawi
on 10 Oct 2011
0 votes
Do you have the function called out as FFT(x) or fft(x)? Functions are case sensitive...
Categories
Find more on Measurements and Spatial Audio in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!