フィルターのクリア

Trying to perform Fast Fourier Transform

2 ビュー (過去 30 日間)
Ryan
Ryan 2022 年 12 月 1 日
回答済み: Walter Roberson 2022 年 12 月 1 日
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 件)

Community Treasure Hunt

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

Start Hunting!

Translated by