MATLAB: 3D Matrix find max values of each position in the first 2 dimensions

2d3darraydimensionsmatrixmax

I have a 3D matrix that represents a collection of sensor readings.
The matrix's first 2 dimensions describe the position of the sensors and the values themselves are the readings the sensor did.
The third dimension in the matrix are the times at which each measurement was taken. I need to transform this 3D matrix into a 2D one with just the the max values for each position in the first 2 dimensions to later transform this into a heatmap which represents the max values in each position over the entire time.
I assume this is probably an easy task but I am very new to Matlab so I would be very glad about any help.

Best Answer

  • It sounds like you need this:
    data_2D=max(data_3D,[],3);
    The explanation for this syntax can be found in the documentation.