Breaking A Table into Smaller Tables Automatically Based on Specific Values

조회 수: 2 (최근 30일)
Craig Stevens
Craig Stevens 2020년 3월 30일
댓글: Tommy 2020년 3월 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
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 CenterFile Exchange에서 Tables에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by