Trying to perform Fast Fourier Transform
조회 수: 1 (최근 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?
댓글 수: 0
채택된 답변
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Fourier Analysis and Filtering에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!