I am programming FEM in Matlab and I created a 3D mesh that had numbered nodes. I want to select a node and that the algorithm tell me the number of the node. How can I do this?
Once your mesh is displayed in a figure, you pick the Data Cursor (Tools > Data Cursor ; or from it's icon, a black cross on a blue line with a yellow panel aside).
Then simply click the desired node to show-up its coordinates.
Note that this doesn't actually gives you the corresponding indices of the node, but only it's spatial coordinates in the current figure.
To get back to the index, you may:
- either look in your coordinates table (can be boring)
- or modify the data cursor panel to show you what you expect (can be a bit tricky).
I was trying to select various nodes of the mesh with the Data Cursor tool and I created a variable named "cursor_info", but the answer was something strange. For example:
cursor_info.Position
ans =
0 0 1
ans =
0.5000 0 1.0000
With this kind of answer, I can´t search the indices in the coordinates table. However, I found that Brush/ Select Data command (righ hand side of the "Data Cursor" icon) could do the same and better work.
With "Brush/ Select Data" I selected diferent nodes and I found the indices with the folowing code: