Hi everyone,
I have a "big" table that has a data an time column. I want to split this big table into smaller one based upon indexes and name them all differently. Can anyone help?

 採用された回答

Walter Roberson
Walter Roberson 2023 年 2 月 13 日

0 投票

At_a_time = 72; %for example
G = 1 + floor((0:height(YourTable)-1) / At_a_time).';
vars = YourTable.Properties.VariableNames;
parts = splitapply(@(varargin) table(varargin{:}, 'VariableNames', vars), YourTable, G);
parts will now be a cell array of tables, each height At_a_time.
There are more efficient ways using explicit loops.

2 件のコメント

Walter Roberson
Walter Roberson 2023 年 2 月 13 日
Naming them all differently would involve dynamic generation of variable names, which is not recommended.
Lotte Piek
Lotte Piek 2023 年 2 月 15 日
thanks!!

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

その他の回答 (0 件)

カテゴリ

製品

リリース

R2022b

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by