Import Data Error (Attempt to reference field of non-structure array)
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Walter Roberson
am 8 Nov. 2013
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 Kommentare
Siehe auch
Kategorien
Mehr zu Calendar finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!