Trimming structure of Arrays
Mostrar comentarios más antiguos
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
Respuesta aceptada
Más respuestas (2)
TAB
el 28 de Sept. de 2011
Data=structfun(@(x) ( x(6:end) ), Data,'UniformOutput', false);
Daniel Shub
el 28 de Sept. de 2011
It looks like all you arrays are the same size. You may want to consider a structure array instead of a structure with lots of arrays. This way you could then just do:
Data = Data(6:end);
to remove the first 5 elements.
Categorías
Más información sobre Whos en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!