I have a 1D (very big one) array like below:
data =[ 2 5 0 15 12 7 4 8 19 14 20 25 18 13 40 ];
I want to make the lowest value to zero in every 3 element. I firstly reshaped it to be like:
reshaped_data =
2 15 4 14 18
5 12 8 20 13
0 7 19 25 40
And then sorted each column and now I have the indices of the sorted data as below.
sorted_data_index =
2 1 3 3 3
1 2 2 2 1
3 3 1 1 2
So, please let me know how can I use sorted_data_index as indices of reshaped_data to be able to make the lowest values zero?
I can do this within a for loop, but it would be very slow.
Thanks
Best Answer