フィルターのクリア

How to concatenate table elements?

2 ビュー (過去 30 日間)
Atanu
Atanu 2022 年 3 月 19 日
編集済み: Atanu 2022 年 3 月 19 日
I am trying to concatenate the table elements of which each of them are double array. How can I do it effectively? I have attached the table for
reference. Basically I am trying to put together all the coordinatetimes values together.
  2 件のコメント
Walter Roberson
Walter Roberson 2022 年 3 月 19 日
I am not clear what you are trying to concatenate to what, or which dimension you are trying to concatenate over?
Atanu
Atanu 2022 年 3 月 19 日
Sorry for not being clear enough. I am trying to concatenate by column. I have written this piece of code which worked.
all_trials_on_date_coordinatetimes = [];
all_trials_on_date_xcoordinates = [];
all_trials_on_date_ycoordinates = [];
for idx = 1:length(all_trials_on_date.coordinatetimes)
all_trials_on_date_coordinatetimes = cat(1, ...
all_trials_on_date_coordinatetimes, ...
all_trials_on_date.coordinatetimes{idx, 1});
all_trials_on_date_xcoordinates = cat(1, ...
all_trials_on_date_xcoordinates, ...
all_trials_on_date.xcoordinates{idx, 1});
all_trials_on_date_ycoordinates = cat(1, ...
all_trials_on_date_ycoordinates, ...
all_trials_on_date.ycoordinates{idx, 1});
end
But, I am wondering if there is a simpler way for table which might not know.

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2022 年 3 月 19 日
all_times = vertcat(all_trials_on_date.coordinatetimes{:});
  1 件のコメント
Atanu
Atanu 2022 年 3 月 19 日
編集済み: Atanu 2022 年 3 月 19 日
Awesome! Thank you!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

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

タグ

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by