Map triplets to a matrix
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Alexandra McClernon Ownbey
am 12 Jul. 2020
Beantwortet: Thiago Henrique Gomes Lobato
am 12 Jul. 2020
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 Kommentar
KSSV
am 12 Jul. 2020
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.
Antworten (1)
Thiago Henrique Gomes Lobato
am 12 Jul. 2020
[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 Kommentare
Siehe auch
Kategorien
Mehr zu Delaunay Triangulation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!