Map triplets to a matrix

8 visualizaciones (últimos 30 días)
Alexandra McClernon Ownbey
Alexandra McClernon Ownbey el 12 de Jul. de 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 comentario
KSSV
KSSV el 12 de Jul. de 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.

Iniciar sesión para comentar.

Respuestas (1)

Thiago Henrique Gomes Lobato
Thiago Henrique Gomes Lobato el 12 de Jul. de 2020
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

Categorías

Más información sobre Surface and Mesh Plots en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by