how can i take average of matrices in a cell?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Joseph
el 15 de Mzo. de 2018
Comentada: Joseph
el 15 de Mzo. de 2018
Hi, i have a cell array X{16*12} in which each element of cell X is a 3d array. now I want to take the average of all the matrices in the row which will result in another cell array Y{1,12} (each element of Y cell array consist of 3d array). can anyone please help me with this.
thank you
5 comentarios
Bob Thompson
el 15 de Mzo. de 2018
Cool, glad I could help. I deliberately avoided putting the answer into a cell matrix since I figured it would just be numbers and a cell matrix of numbers is just extra complicated, but you do what you need to.
Respuesta aceptada
Andrei Bobrov
el 15 de Mzo. de 2018
A - your cell array
one variant
[m,n,k] = size(A{1});
[h,l] = size(A);
A1 = reshape(cat(3,A{:}),m,n,k,h,l);
out = squeeze(num2cell(mean(A1,4),1:3))';
Más respuestas (0)
Ver también
Categorías
Más información sobre Matrix Indexing 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!