How to convert a cell array that contains inside durations to a duration array

2 visualizaciones (últimos 30 días)
Hi, so thats my problem I got a cell array that contain inside a group of duration and I want to split this group of duration to not have the cells. How can I do it? I post the variable so you can see easely what I mean.
  1 comentario
Stephen23 el 11 de Feb. de 2022
Editada: Stephen23 el 11 de Feb. de 2022
Do not use a loop for this. The MATLAB approach is to use a comma-separated list, for example one of:
out = horzcat(All_Time_msg_dist_Max{:})
out = vertcat(All_Time_msg_dist_Max{:})

Iniciar sesión para comentar.

Respuesta aceptada

Benjamin Thompson
Benjamin Thompson el 10 de Feb. de 2022
Not very elegant but the brute force way to copy from your cell array to a duration array:
A = All_Time_msg_dist_Max{1};
for i = 1:length(All_Time_msg_dist_Max)
A(:,i) = All_Time_msg_dist_Max{i};
  4 comentarios
flashpode el 10 de Feb. de 2022
Okay Its already done. I used duration.empty
thank you

Iniciar sesión para comentar.

Más respuestas (0)


Más información sobre Dates and Time 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