Trying to perform Fast Fourier Transform
2 views (last 30 days)
Show older comments
I imported some data and tried to use the fft function on it to perform a fast fourier transform. When I run the code, an error comes saying the argument must be one of many listed data types, including a double, of which the data is (16384x1).
vtx_30 = importdata("M006_vortex_30.txt")
vtx_45 = importdata("M006_vortex_45.txt");
vtx_30 = fft(vtx_30)
What seems to be the issue?
0 Comments
Accepted Answer
Walter Roberson
on 1 Dec 2022
importdata() can return any of three different data types, depending on the content of the file.
If the file is text and has at least one header line or one comment anywhere in the file, then importdata() will return a struct with fields textdata and data with the textdata field containing the text that was read, and with data containing the numeric array.
If that is what happened then you would be trying to perform fft() on a struct rather than on the numeric data.
We recommend against using importdata() because it is too unreliable that way, too many cases you have to think to test for afterwards. Use readmatrix() or readtable() instead.
0 Comments
More Answers (0)
See Also
Categories
Find more on Fourier Analysis and Filtering 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!