MATLAB: Trimming structure of Arrays

MATLABstructures

Hi Guys
I have a structure like this:
Data =
dateTime: [4906x1 double]
aircraftLat: [4906x1 double]
aircraftLong: [4906x1 double]
aircraftMSL: [4906x1 double]
aircraftSpeed: [4906x1 double]
aircraftCourse: [4906x1 double]
gcsLat: [4906x1 double]
gcsLong: [4906x1 double]
gcsMSL: [4906x1 double]
antAz: [4906x1 double]
antEl: [4906x1 double]
rssi: [4906x1 double]
I'd like to take the first 5 elements of each array and remove. Is there a neat solution for this? Or would I have to go into each array eg. Data.aircraftLat(1:5) = [], etc.
Thanks
Amir

Best Answer

DataField = fieldnames(Data);
for iField = 1:numel(DataField)
aField = DataField{iField};
Data.(aField) = Data.(aField)(5:end);
end