merge duplicate entries and take average associated columns
1 view (last 30 days)
Show older comments
I have a question about making a matlabscript out of this excel sheet respresenting activity recognition. Our goal is to merge the numbers representing the activities and take the avarage of each colums representing the features.
In our excel sheet 1=lie, 2=sit, 3=stand and 4= walk. We want to merge these identical valuea, unless they are separated by another value. So for example we want to turn A in B :
A=[1 1 1 2 2 3 3 3 4 4 4 2 2 2 3 ] --> B = [ 1 2 3 4 2 3]. So we don't want to sort each number and then take the unique function. But we want to seperate them by chronilogical order. While merging these numbers together, we also want to take the avarage of the other seperate colums (our features)
In the attachment, you can find an example of a part of our excel sheet.
We hope someone can help us out ;)
0 Comments
Answers (1)
KSSV
on 10 Jun 2021
A=[1 1 1 2 2 3 3 3 4 4 4 2 2 2 3 ];
% B = [ 1 2 3 4 2 3]
B= A(diff([0 A])~=0)
0 Comments
See Also
Categories
Find more on Spreadsheets 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!