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

2 views (last 30 days)
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
xo=-0.05:0.0004:0.05;
id =[]
k=1;v2=0
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)
v2(k)=0;
w2(k)=0;
y2(k)=xo(j)%mean(y1(idx)); %
z2(k)=z(i) %mean(z1(idx));%
else
y2(k)=mean(y1(idx)); %
z2(k)=mean(z1(idx));%
v2(k)=mean(v(idx));
w2(k)=mean(w(idx));
end
k=k+1;
end
end
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)

Categories

Find more on Resizing and Reshaping Matrices in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!