select complex numbers from cell array based on the real part
4 views (last 30 days)
I have a 7D cell array with complex numbers.
I want to keep the complex number with the highest real part, of all the values of the 3rd parameter (1:15).
For example in this case i want only the val(:,:,14,1,1,1,1) which has the highest real part.
I tried to do it using the following command
maxVal = max(cell2mat(my_array),,3);
However, it keeps the complex number with higher imaginary part. In this case
Any idea of how can i do this?
dpb on 3 Jun 2020
Well, if you want the max() of the real part, then you'll have to limit to only looking at the real part -- max() for complex returns max(abs())
[maxRealVal,imxR] = max(real(tmp));