Map triplets to a matrix
조회 수: 6 (최근 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
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
2020년 7월 12일
[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
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Delaunay Triangulation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!