Converting 3D data to 2D
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Josh K
el 6 de Dic. de 2017
Comentada: Josh K
el 6 de Dic. de 2017
I have a 50x4 matrix with the columns being x, y, z, and a value. I want to average each x,y point through the z to convert my 3D data to a 2D.
2 comentarios
Walter Roberson
el 6 de Dic. de 2017
Does your data form a regular grid, perhaps 5 x 5 x 2 ?
Or is it scattered data that is not on a grid?
Respuesta aceptada
Jos (10584)
el 6 de Dic. de 2017
So, you want to ignore the z, and average the values for each specific combination of (x,y)?
xyzv = [1 1 1 10 ; 1 1 2 20 ; 1 2 3 30 ; 1 2 5 40 ; 2 2 4 10] % test data
[xy,~,j] = unique(xyzv(:,[1 2]),'rows') % unique combinations of (x,y)
xyv = [xy accumarray(j,xyzv(:,4),[size(xy,1),1],@mean)] % ignore z, average v
Más respuestas (0)
Ver también
Categorías
Más información sobre Animation 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!