Trimming structure of Arrays
Afficher commentaires plus anciens
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
Réponse acceptée
Plus de réponses (2)
TAB
le 28 Sep 2011
Data=structfun(@(x) ( x(6:end) ), Data,'UniformOutput', false);
Daniel Shub
le 28 Sep 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.
Catégories
En savoir plus sur Structures dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!