Creating n number of tables using already present table in matlab
3 ビュー (過去 30 日間)
古いコメントを表示
I'm trying to create n number of tables based on a main table that I have. I want to create this micro tables on column conditions from main table.
First micro table will be between adjacent 0 speed(column) and odometer(first to last of micro table) condition of greater than 0km.
I want to generated yellow tables as shown in attachment.
0 件のコメント
回答 (3 件)
Nitin Kapgate
2020 年 12 月 14 日
You can refer to the following code snippet to learn about extracting sub-tables based on conditions on the data in columns of main table:
% Create a table by reading all columns from the file, patients.dat.
T = readtable('patients.dat');
T(1:5,:)
% View the data type, description, units, and other descriptive statistics
% for each variable by creating a table summary using the summary function.
summary(T) % A table with 100 rows
% Get a sub-table based on conditions on columns
T_New = T((T.Height > 67) & (T.Weight > 142.5), :);
summary(T_New) % A sub-table with 40 rows
0 件のコメント
Eric Sofen
2020 年 12 月 14 日
I would advise that in many cases, you're better off adding a grouping variable based on the conditions you described and doing grouped calculations (using groupsummary, varfun, or findgroups/splitapply) rather than splitting your table into a bunch of separate workspace variables. Once you've got a bunch of subtables with different names in your workspace, they become hard to iterate over compared to one table with a grouping variable.
0 件のコメント
Ali Sarab
2021 年 6 月 30 日
How to create n tables from one tables by categories in for loop
for ii=1:n
names of tables=???
end
how to assigned automatic naming based on the grouping variable
unstack command in matlab create one table grouped
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!