Assume you have a structure gps, containing gps.time, gps.lon, gps.lat and gps.version. The first 3 variables have the same length, gps.version contains a single value for the version. If you want to delete the first 100 entries from the gps time and coordinates from the structure, following code would handle it:
gps = structureDelete(gps,1:100,numel(gps.time));
The script proves most useful with larger structures than the one shown in the example. It runs up to two levels deep, so if above mentioned structure contained gps.coordinate.lon, gps.coordinate.lat, it would be handled as well. You can always add another loop in your code in case you want to dig even deeper.
Florian Aendekerk (2019). structureDelete (https://www.mathworks.com/matlabcentral/fileexchange/69200-structuredelete), MATLAB Central File Exchange. Retrieved .
1.0.1 | description added |
Create scripts with code, output, and formatted text in a single executable document.