Remove rows from a table based on the amount of rows in another table
2 views (last 30 days)
Show older comments
I have two tables, Table1 and Table2 and I'm using them to create a master table called Final.
Table2 is considerably larger than Table1 and I dont need the extra data it provides in those rows. I can get this to work by just looking at the amount of rows and manually entering this value as below:
% Count rows in Table1
rowsd=size(Table1, 1);
% Remove extra rows in Table2
Table2([35400:end], :)=[];
This will remove the rows I dont need and all is good and I can then write my Final table. However, Table1 size will be different each time I use this script I'm writing due to differing input files. I want it to count the number of rows and then use that answer to automate this process.
I've tried the following but just get an error. Can anybody help please? Thank you
% Count rows in Table1
rowsd=size(Table1, 1);
% Remove extra rows in Table2
Table2([rowsd:end], :)=[];
5 Comments
Answers (0)
See Also
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!