How to Merge rows inside table where Security and Date are equal into one and add other columns
Show older comments
SECURITY DATE PRICE PE LASTPRICE
IBM 01/01/2020 5
IBM 01/01/2020 20
IBM 01/01/2020 7
IBM 02/01/2020 7
How can i combine first three rows into one and leave last one remaing using one table?
so I should see
IBM 01/01/2020 5 7 20
IBM 02/01/2020 7
Accepted Answer
More Answers (2)
Sai Gudlur
on 12 Jun 2020
0 votes
Hello,
Below code might work for u.
A = ['IBM';'IBM';'IBM'];
B = ['01/02/2020';'02/05/2020';'03/06/2020'];
C = [5;6;7];
D = [1;2;3];
E = [5;6;7];
T1 = table(A,B,C,D,E);
T2 = mergevars(T1,[3 4 5]);
Mark McGrath
on 12 Jun 2020
0 votes
Categories
Find more on Aerospace Blockset 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!