01-10-2017 02:09 PM
Hi all,
I can't figure out how to take a 2D array, and sepearte out just the Z values into a 1D array so I can find the average of them, and std deviation etc..? I'm trying to write a program that analyzes some data I have taken, and I can plot it, take cross sections of it, but I can figure out how to average the intensity values in a region because I'm not sure how to seperate out the Z values form the 2D array.
Any help would be great!
Thanks
01-11-2017 04:41 AM
What do you mean with separate the Z values from the 2D array? The 2D array IS your Z value set.
If you want to calculate average or STD of your entire 2D data set you can first reshape it to a 1D array of length L = X * Y where X and Y are your 2D array dimensions. Alternatively run your 2D array through a FOR loop and calculate the average or STD of each row. This will give you an array of results then outside your loop calculate the average or STD of your result array.
To only work on a 2D subset of data use the Array Subset primitive to extract your rectangle of interest.
01-11-2017 12:27 PM
I guess I was a bit confused, I was thinking the 2D array was all the X,Y,Z values but now that I think about it that wouldn't make any sense. Your suggestion worked though, I made it into a 1D array of Length=X*Y and was able to take the mean, std, variance, etc..
Thanks for your help