transform duration into some visible in the table

16 ビュー (過去 30 日間)
Tom Bedkowski
Tom Bedkowski 2019 年 1 月 30 日
回答済み: Peter Perkins 2019 年 1 月 31 日
Hello,
i got a cell array which is on the picture shown.
In this array is 'duration' shown and not the value. Why this happend and how can i avoid this problem?
Thank you for help!

採用された回答

Ollie A
Ollie A 2019 年 1 月 30 日
Duration just refers to the format of the data stored in each cell array.
You could convert your cell to a table, which might handle your data in a format you prefer:
T = cell2table(yourcell);
Or you could try extracting each cell and converting it to the duration in seconds:
for x = 1:length(yourcell)
M(x) = seconds(yourcell{x});
end
I hope this helps!

その他の回答 (1 件)

Peter Perkins
Peter Perkins 2019 年 1 月 31 日
You have a cell array, each cell of which contains a scalar duration. That explains the Variable Editor display you are seeing. You should figure out how you got there, because that's not a good way to store durations. You certainly can create a table out of that, but more fundamentally, you should just create a duration vector. Here's the best way to do that:
>> c = {seconds(1); seconds(2); seconds(3)}
c =
3×1 cell array
{[1 sec]}
{[2 sec]}
{[3 sec]}
>> d = vertcat(c{:})
d =
3×1 duration array
1 sec
2 sec
3 sec

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by