Trying to perform Fast Fourier Transform

2 次查看(过去 30 天)
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?

采纳的回答

Walter Roberson
Walter Roberson 2022-12-1
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 个)

类别

Help CenterFile Exchange 中查找有关 Fourier Analysis and Filtering 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by