Group data for location
2 views (last 30 days)
Show older comments
Sarah Yun
on 28 Dec 2019
Commented: Walter Roberson
on 29 Dec 2019
Hello,
I have sales data column for 3 indepedent stores, A, B and C, in 3 seperate tables
I want to merge table A and B and test if there is difference between this group and store C
So, store A + B against C
tableA
tableB
tableC
% Concatenate columns vertically
x = [A;B;C];
% the tables do not have equal rows,
% therefore must concatenate them into a single column and use a grouping variable
% How should I change next line to make group A+B and single group C
group = [1 + zeros(size(A)); 2 + zeros(size(B)); 3 + zeros(size(C))];
% How should I change next line to make group A+B and single group C?
Thank you
0 Comments
Accepted Answer
Walter Roberson
on 28 Dec 2019
Edited: Walter Roberson
on 28 Dec 2019
group = [ones(size(A,1) + size(B,1),1); 2*ones(size(C,1),1)];
2 Comments
Walter Roberson
on 29 Dec 2019
group = (x.Year < 2010) + 1;
However you need to resolve the question of whether year 2010 is first group or second group.
Here, x represents the [A;B;C] combined table you made. x.Year assumes that there is a variable in the table named Year; if not then use an appropriate expression to extract the year from what you do have.
More Answers (0)
See Also
Categories
Find more on Logical 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!