Reputation: 1
This is the error I received:
Error using maineffectsplot (line 99)
GROUP must be a cell array or matrix of grouping variables with the same length as Y.
This is my code:
%% main effect plot
data = [0.9000 1.0000 1.0000; 1.1000 1.1000 1.2000; 1.2000 1.1000 1.1000; 1.4000 1.4000 1.4000;
1.0000 1.0000 0.9000; 1.1000 1.2000 1.1000; 0.9000 0.8000 0.8000; 0.9000 1.0000 0.9000;
0.7000 0.8000 0.7000; 1.1000 1.2000 1.2000; 1.1000 1.0000 1.1000; 1.1000 1.1000 0.9000;
0.8000 0.8000 0.7000; 0.9000 1.1000 1.0000; 0.8000 0.9000 0.8000; 1.1000 1.1000 1.0000];
data = data';
g1 = {'(1)', 'A', 'B' ,'C', 'D', 'AB', 'AC', 'AD', 'BC', 'BD', 'CD', 'ABC', 'BCD', 'ABD', 'ACD', 'ABCD'};
maineffectsplot(data, g1)
The help maineffectsplot says "Each grouping variable must have the same number of rows as Y" Y has 16 rows, g1 has 16 rows as well, I don't understand why do I receive this error
I tried different combination of data, g1 ; data, g1' etc none of these work
This picture confirmed that I somehow managed to have them both have 16 rows
Thank you!
Upvotes: 0
Views: 555
Reputation: 885
You only need one cell in g1, but it has to contain 16 rows. Try using
g1 = {['(1)';'A';...;'ABCD']}
Upvotes: 1