Breaking A Table into Smaller Tables Automatically Based on Specific Values
1 次查看(过去 30 天)
显示 更早的评论
I have a table called Data which has values similar to below. The Time column is continuous while the Run column only increases each time a new set of non-zero data is collect. What I want to do is to create tables from this table with each table just being a specific run. So DataRun1 will be only occur from 3-7 seconds. After this I want to automatically export these new smaller tables to .txt files. I appreciate any help which can be provided.
1 个评论
Tommy
2020-3-30
If your table is in T, try this:
for i = unique(T.Run)'
writetable(T(T.Run == i,:), ['Run ' num2str(i) '.txt']);
end
回答(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!