Separating subtables from a larger table by using the variable values in a column
Show older comments
I got a data folder with 19023 txt files. Each of the txt files have the data of 71 electrodes (indicated by the first column x_) like this:

As a preview, it shows only the first 7 rows.
I have created a datastore and selected the variables of interest using the codes below:
ds = datastore("data")
vars = ds.VariableNames;
idx = ismember(vars,["x_", "P1_xm_","P2_xm_","Rho","I","U","D","Time"]);
ds.SelectedVariableNames = vars(idx)
data = readall(ds)
I want to create 71 time series tables for each of electrodes, so I used the code:
e1 = data(data.x_==0,:)
And obtained the resulted table for the Electrode No.0.

However, I need to further process and analyse the individual table later on, it will be very time consuming to do repeat the same codes for 71 times every time. Is there a simpler method such as using a loop to generate 71 time series tables for individual electrodes?
Thank you in advance.
Accepted Answer
More Answers (0)
Categories
Find more on Tables in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!