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

3 vues (au cours des 30 derniers jours)
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 commentaire
Stephen23
Stephen23 le 11 Fév 2022
Modifié(e) : Stephen23 le 11 Fév 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{:})

Connectez-vous pour commenter.

Réponse acceptée

Benjamin Thompson
Benjamin Thompson le 10 Fév 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};
end
  4 commentaires
flashpode
flashpode le 10 Fév 2022
but this is gonna give me the second column after the first one? couse what I want is to get both durations of the cell consecutive.
flashpode
flashpode le 10 Fév 2022
Okay Its already done. I used duration.empty
thank you

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by