Combine vectors of different length into a matrix and perform ANOVA.
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
NMarco
am 18 Jan. 2021
Kommentiert: Adam Danz
am 18 Jan. 2021
Hello,
I have 20 vertical vectors all of different lenghts.
a = 1x876;
b = 1x900;
c = 1x852;
...
y = 1x798;
I'd like to merge them into a single matrix in which each column is one vector (n x 20) and then perform an ANOVA.
Unfortunately a cannot combine vectors of different lenght in one matrix. Is there a way to fill in the empty spaces with a NaN value (probably taking the lenght of the longest one)?
Or maybe there are other methods of which I have no knowledge to perform an ANOVA listing all the variable to be taken into account?
Thank you!
0 Kommentare
Akzeptierte Antwort
Adam Danz
am 18 Jan. 2021
Bearbeitet: Adam Danz
am 18 Jan. 2021
The dimensions you provided indicate that the vectors are row vectors, not column vectors.
If you're performing a 1-ways ANOVA using anova1, you don't have to create a matrix. Use the grouping variable instead. For row vectors,
y = [a,b,c,d];
group = repelem(1:4, 1, [numel(a),numel(b),numel(c),numel(d)])
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu ANOVA finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!