Import Data Error (Attempt to reference field of non-structure array)
조회 수: 1 (최근 30일)
이전 댓글 표시
This is my code:
%
E1 = importdata('shaker18.dat');
Data = E1.data;
FreqE1 = Data(1:end-1,2); %frequency (Hz)
AmpEA1 = Data(1:end-1,3); %amplitude of accelerometer (V)
AmpEH1 = Data(1:end-1,4); %amplitude of hammer (V)
%
When I go to import my data, I get an error saying "Attempt to reference field of non-structure array." I know how to import data because I've done it for other files. The data in the file looks fine. There are 4 columns and 23 rows and there is a value for each space, so I don't know what to do. All help is appreciated!
댓글 수: 0
답변 (1개)
Walter Roberson
2013년 11월 8일
In the importdata documentation, have a look at "Import a Text File and Return Detected Delimiter". You can see there that in at least some cases, the data can be returned as a plain numeric array rather than a structure.
if isstruct(E1)
Data = E1.data;
else
Data = E1;
end
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Calendar에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!