How to plot 3D data values in a 2D map?
Show older comments
Hello,
For a project I am working on, I have a truckload of data. For a few hundred thousand points in a room, I have x-, y- and z-coordinates and a value of the amount of radiation there. Here, y is the height and x and z are the width and breadth of the room. I want to plot this in a top-view, so adding all y-values for a certain (x,z) together, and then plotting the resulting values in a heat map to show where there is a lot of radiation and where you're fairly safe.
My data is of the format (x, y, z, value):
1 1 1 v1
1 1 2 v2
1 1 3 v3
1 1 4 v4
1 2 1 v5
1 2 2 v6
1 2 3 v7
1 2 4 v8
2 1 1 v9
etc.
I already have variables for the unique number of x-, y- and z-points. Let's say I sampled 5 x-, 4 y- and 3 z-locations. I would like to write a loop that automates the addition of, in this scenario, v1, v4, v7 and v10 (the row increases by the number of z-points and the number of values that are added together are the number of sampled y-points), and then of v2, v5, v8, v11, etc. Is there any easier way than three nested for-loops? For now, that is all I can come up with, but I hope there's a more straightforward way of getting the plot I want.
Accepted Answer
More Answers (0)
Categories
Find more on Data Distribution Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!