To take mean/average array values xyz(4,:) or xyz(5,:) at xyz points to reduce number of data points/averaged

1 view (last 30 days)
sanjeet on 11 Sep 2015
Edited: Walter Roberson on 13 Sep 2015
I am interested to reduce the data array as big as xyZ=9 X 275416 size, with first three column having xyz co-ordinates. let take mean values at each near by x, y , z values and make size small. The mean will be for xyz(4,:), xyz(5,:) and so on which are other than co-ordinate . This will make it easy to analyse in scatter plot(as when I plot now one color overlap other)
I try using the following : where z1 is = xyz(3,:) z -cordinate points , y1 is y co-ordinates, y1 and z1 used to get the index for the many points at near by for each grid x y z values in reduced scale. z and xo are the reduced grid points.
But its too much for big data time is slow
% vector array to less number of points
z= 0.00:0.01:0.1; % divide z and X to some number of grid points for 3D space
id =[]
for i=1:length(z)
for j=1:length(xo)
idx=find(z1+z(i)>-0.0005 & (z1+z(i)<0.0005) & y1-xo(j)>-0.0005 & y1-xo(j)<.0005) % dz +dx % index location nearest to point array to xyz2
if (isempty(idx)==1)
y2(k)=xo(j)%mean(y1(idx)); %
z2(k)=z(i) %mean(z1(idx));%
y2(k)=mean(y1(idx)); %
I wannt something which is fast : can we use vector as condition for find() function, as that will return index - idx as vector/1D array then I can remove the for loop and make it in time. The mean also can be done as mean vector

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!