Is it possible to split a table into multiple tables based in ID (a number code) in colum A?
Show older comments
I have a huge .csv file with stock information. Its over 1 million rows. Right now each company has a number ID variable in colum A, and additional daily stock information in 19 columns from B and onwards. What I want is to be able to split the combined table into x amount of seperate tables so that each company are seperated and containing all the 19 variables per day. Is that possible?
I imported the file with readtable
Thank you for any help
Accepted Answer
More Answers (2)
Peter Perkins
on 23 Jan 2019
2 votes
Kristian, as Walter demonstrates, it is easy to do. But you may find that splitting it up is less convenient than keeping it together, depending on what you need to do after. There are several different ways to do "grouped calculations" on the not-split-up table, those would be tedious if you had dozens of separate tables.
1 Comment
Kristian Opsahl
on 24 Jan 2019
Kevin Chng
on 17 Jan 2019
Edited: Kevin Chng
on 17 Jan 2019
Example
ID = ['A';'A';'A','B';'B'];
Var1 =[1;2;3;4;5];
Var2 =[2;3;4;5;6];
tableCombine = table(ID,Var1,Var2)
How to segregate A nad B out?
tableA = tableCombine(tableCombine.ID=='A',:);
tableB = tableCombine(tableCombine.ID=='B',:);
Categories
Find more on Timetables 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!