Map triplets to a matrix

조회 수: 8 (최근 30일)
Alexandra McClernon Ownbey
Alexandra McClernon Ownbey 2020년 7월 12일
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
Thiago Henrique Gomes Lobato 2020년 7월 12일
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