??? Undefined function or method 'FFT ' for input arguments of type 'char'.

12 ビュー (過去 30 日間)
Sarah
Sarah 2011 年 10 月 10 日
コメント済み: Walter Roberson 2017 年 9 月 13 日
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

採用された回答

Kevin
Kevin 2011 年 10 月 10 日
Do you have signal processing toolbox?
If so, I would recommend that you put a debug stop inside fft1 at where the function fft is called to make sure the inputs make sense. It sounds like your inputs are not correct.
  4 件のコメント
Abhishek Sharma
Abhishek Sharma 2017 年 9 月 13 日
how did u remove this problem?.. i am facing the same prob. i was taking fft2 of an image and getting the same error 'Undefined function 'fft' for input arguments of type 'char'.'
Walter Roberson
Walter Roberson 2017 年 9 月 13 日
Sarah had a file name that had a space in the middle of it. Your .m file names must not have any spaces in the actual file name.

サインインしてコメントする。

その他の回答 (4 件)

Walter Roberson
Walter Roberson 2011 年 10 月 10 日
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 件のコメント
Sarah
Sarah 2011 年 10 月 10 日
BTW, it is named as fft1 without a space, and I have called it as such.
Sarah
Sarah 2011 年 10 月 10 日
So for example, I put:
dbstop if error;
y = fft(x);
^This is inside of the mfile for my fft1 function. If I try to run it, I still get the same error.

サインインしてコメントする。


Iman Alsharkawi
Iman Alsharkawi 2011 年 10 月 10 日
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 件のコメント
Kevin
Kevin 2011 年 10 月 10 日
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
Sarah 2011 年 10 月 10 日
Tried it. x in this case is T1.Signal:
T1.Signal 16559 x 1 double
It reads it as a double...so I don't really understand why or where it is reading char...also look below at my new answer for further results.

サインインしてコメントする。


Sarah
Sarah 2011 年 10 月 10 日
Another thing everyone...I just found this out. I can run the code by clicking the "evaluate selection" and letting it evaluate the whole block. I get the following:
T1.Signal 16559 x 1 double
T1.Time 16559 x 1 double
T1.f 8279 x 1 double
T1.y 8279 x 1 double
However, if I actually run the simulation using the run *.m button, I get the error mentioned previously.
  1 件のコメント
Sarah
Sarah 2011 年 10 月 10 日
In this case, I am using T1.Signal in place of "x"

サインインしてコメントする。


Iman Alsharkawi
Iman Alsharkawi 2011 年 10 月 10 日
Do you have the function called out as FFT(x) or fft(x)? Functions are case sensitive...
  1 件のコメント
Sarah
Sarah 2011 年 10 月 10 日
As far as I know, I don't have a function called out as FFT. That is why I am so confused...the error either refers to fft(x)(which I am aware of) or something called FFT(x) which I am not aware of.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by