Borrar filtros
Borrar filtros

Is there a quick method to remove data from a structure?

3 visualizaciones (últimos 30 días)
Duncan Wright
Duncan Wright el 9 de Oct. de 2017
Comentada: Duncan Wright el 10 de Oct. de 2017
I'm trying to remove data from my structure (ie first 27000 points).
I am aware of a method I could use (demonstrated below), but I was wondering if there is a more efficient method?:
Data2.Time = Data2.Time(27000:end)
Data2.MissingData(27000:end)
Data2.TimeStampsMatlab(27000:end)
Data2.Range(27000:end)
Data2.Vel_Beam1(:,27000:end)
I have 100+ variables so ideally I don't have to do this..
Thanks!
  2 comentarios
James Tursa
James Tursa el 9 de Oct. de 2017
Do you have 100 variables named Data1, Data2, Data3, etc?
Guillaume
Guillaume el 9 de Oct. de 2017
Editada: Guillaume el 9 de Oct. de 2017
I believe he means he's got 100 fields, not variables.

Iniciar sesión para comentar.

Respuesta aceptada

Guillaume
Guillaume el 9 de Oct. de 2017
If I understood correctly, all that would be needed is:
Data2 = structfun(@(fld) fld(:, 27000:end), Data2, 'UniformOutput', false);

Más respuestas (0)

Categorías

Más información sobre Structures en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by