Borrar filtros
Borrar filtros

Sort structure by datetime

5 visualizaciones (últimos 30 días)
Kaan Aydin
Kaan Aydin el 24 de Jul. de 2020
Respondida: Jalaj Gambhir el 27 de Jul. de 2020
Hello everybody,
i have an automatically generated cell array with ceveral structs inside of it. The size of every struct array is identical and has its own datetime field.
What i want to do is to sort the different structs in the cell array by their measurement date/time.
I tried it with the way below but didn´t get the result i expected.
for runs=1:iMess
data.Runs{runs, 1}=struct2table;
date_list = [data.Runs{runs, 1}(1).MeasBegin];
[~, data.Nebenvariablen.date] = sort(date_list);
data.Runs{runs, 1} = data.Runs{runs, 1}(data.Nebenvariablen.date);
end
I hope you can help me with this.
  2 comentarios
Kaan Aydin
Kaan Aydin el 24 de Jul. de 2020
of course the second line should be
data.Runs{runs, 1}=struct2table(data.Runs{runs,1});
dpb
dpb el 24 de Jul. de 2020
Attach the struct array.

Iniciar sesión para comentar.

Respuesta aceptada

Jalaj Gambhir
Jalaj Gambhir el 27 de Jul. de 2020
Hi,
Please provide the struct for us to give you the exact solution. Kindly refer to this link for suggested solutions. Hope this helps!

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