Map triplets to a matrix

8 次查看(过去 30 天)
I have multiple structured meshes of a 2-D mesh that I merged together in pointwise (technically making it unstructured). The data is output into a triplet format:
Variable Names: x y z mach density ...
I am able to map the data run on a structured mesh by reshaping the column vectors into a matrix. I cannot do the same thing with a combination of structured meshes. I can; however, map the mesh in blocks of structured meshes. I import the data from pointwise through a .dat file and get my respective mesh to create the mesh in matlab. The output data is not structured the same way as the pointwise .dat file, so I can't map it directly.
After importing my mesh into matlab, I have a map of each x-y coordinate (z is a constant 0 since it is 2-D). To map each data point onto the mesh, I need to find the matching coordinates and assign the respective information to that point.
Is there a way I can map the data points without using a nested for-loop to search for each coordinate? Unfortunately, I cannot provide sample data.
  1 个评论
KSSV
KSSV 2020-7-12
Is there a way I can map the data points without using a nested for-loop to search for each coordinate?
Off course there would be...
Unfortunately, I cannot provide sample data.
We cannot help further unless data is provided.

请先登录,再进行评论。

回答(1 个)

Thiago Henrique Gomes Lobato
You can try the ismembertol function:
[XX,YY] = meshgrid(0:0.1:1,0:0.1:1);
Points = [XX(:),YY(:)];
PointsToMatch = [0,0;
0.5,0.3];
tol = 0.001; % tol for double accuracy
idx = find(ismembertol(Points,PointsToMatch,tol,'ByRows',1));
Points(idx,:)
ans =
0 0
0.500000000000000 0.300000000000000

类别

Help CenterFile Exchange 中查找有关 Surface and Mesh Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by