Extract data from surface (4x1) to 2D matrix

Hey
I created a 4x1 surface by extracting slices from a 3d grid.
process: x,y,z & D all 160056x1 double xq, yq & zq are mesh
1) 3Dgrid=(x,y,z,Data, xq,yq,zq)
2)xslices=[MinX,MaxX], yslice=MaxY (not needed for my purpose, can I leave it out?), zslice=MaxZ
Slicedata=slice(xq,yq,zq,3Dgrid,xslices, yslice, zslice)
This gives me now a 4x1 surface, I want to get this data, 3 of the 4 slices, in 2d matrices or one 2d matrix so I can visualize the data in a 2d plot. How do I do this, extract data from surface (4x1) in to 2D matrix?
Kind regards,
Jeroen

Answers (2)

When you use
Slicedata=slice(xq,yq,zq,3Dgrid,xslices, yslice, zslice) ;
Slicedata, thois has all the information. You can extract your coordinates (x,y) from this. Like below:
X = get(Slicedata,'XData') ;
Y = get(Slicedata,'YData') ;
Now you can use
surf(X,Y)
[X,Y]=meshgrid(min(x):1:max(x),min(y):1:max(y)); 1 is the interval to create the grid
Z=griddata(x,y,z,X,Y);
D=griddata(x,y,Data,X,Y);
subplot(1,2,1);
surf (X,Y,Z);
subplot(1,2,2);
surf (X,Y,Z,D);

Asked:

on 17 Mar 2017

Answered:

on 21 Dec 2021

Community Treasure Hunt

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

Start Hunting!