How to divide a 3d matrix by a 2d matrix along one dimension
20 views (last 30 days)
Tillmann Spellauge on 23 Aug 2018
I have 3d Matrix named Data, consisting of several grey scale Pictures. I want to divide it by a 2d Matix called DataMax containing the maximum intensity among the pictures at a pixel, in order to normalize Data in the 3rd dimension to 1.
I can perform the operation using a for loop:
DataMax = max(Data,,3);
[x,y,z] = size(Data);
Data(:,:,k) = Data(:,:,k)./DataMax;
However I would like to get rid of the loop in order to maximize performance.
Any ideas on how to do this?