I am having trouble figuring out how to find a solution to my problem here. I have found coordinates/indexes of the max value of my array and now I want to shift it to the centre/make it the new centre of the array (not sure how to do this for an even-sized array). After that, I want to create a circle around the max/centre value and make everything outside of the circle 0. Can anyone please help me with this problem or introduce to me some tools/VIs that may help me as I am still new to LV :).
My current conceptual idea is to form the circle around the max value then retrieve that as a subarray and insert it into an initialised 0 array of the same size. But I am still lost on how to do this.
Solved! Go to Solution.
Initialize a new array of zeroes the same size as your current array.
Use array subset to get the section of the current array that you want. Just do something math on the index you want to center up. So a value's row and column, subtract 1 from each, put that into Array Subset with a length of 3 for row and column.
Now use Replace Array Subset on your newly initialized array starting at the row and column indices that are 1 less than its center.
One thing you might have to pay special attention to is edge cases. And this case, I literally mean "edge" case. If the cell to center is at the edge of the array, you don't have any data off the edge of the array to select in your copy. I don't know what you want the result to look like in that case.
And I don't know if the index handling would like working with negative indices and what you would get if you try to get a subarray starting at index (-1,-1)