transform matrices into a single matrix?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
luca buonocore
el 6 de Oct. de 2016
Comentada: luca buonocore
el 6 de Oct. de 2016
how I can transform matrices into a single matrix? I have 20 - 6x6 matrices, and I need to create 1 matrix for cluster analysis. Thanks!
5 comentarios
Respuesta aceptada
Massimo Zanetti
el 6 de Oct. de 2016
Editada: Massimo Zanetti
el 6 de Oct. de 2016
You need to assign each variable to only one row of all_data matrix.
A= [ 1 2 3; 4 5 6; 7 8 9];
B= [10 11 12; 13 14 15; 16 17 18];
C= [19 20 21;22 23 24; 25 26 27];
D= [28 29 30; 31 32 33; 34 35 36];
E= [37 38 39; 40 41 42; 43 44 45];
F= [46 47 48; 49 0 51; 52 53 54];
all_data = [A(:)';B(:)';C(:)';D(:)';E(:)';F(:)']
Y= pdist(all_data);
Z = linkage(Y,'ward');
H = dendrogram(Z,'Orientation','left','ColorThreshold','default');
set(H,'LineWidth',1)
Más respuestas (1)
elias GR
el 6 de Oct. de 2016
Make a 3D matrix. If your 6x6 matrices are in the variables A1,A2,...,A20, then:
A=zeros(6,6,20);
A(:,:,1)=A1;
A(:,:,2)=A2;
...
A(:,:,20)=A20;
At the end all the matrices are inside 1 matrix as you wished, A.
3 comentarios
Ver también
Categorías
Más información sobre Cluster Analysis and Anomaly Detection en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!