Borrar filtros
Borrar filtros

How to write/design a matrix similar to the one outputted by contourf

1 visualización (últimos 30 días)
sparsh garg
sparsh garg el 21 de Sept. de 2021
Comentada: sparsh garg el 21 de Sept. de 2021
So the output of contourf is a matrix of 2xN dimension as described here
Contour matrix, returned as two-row matrix. This matrix contains the contour levels (heights) and the coordinates of the vertices at each level. The data is arranged sequentially in n sets of columns for n contour lines:
  • The first column in each set contains the contour level and the number of vertices at that level. The top number is the contour level, and the bottom number is the number of vertices.
  • Subsequent columns in the set are the (x, y) coordinates of the vertices. Each column represents an ordered pair. The top number is the x-coordinate, and the bottom number is the y-coordinate.
Now let's say that I have a set of points ,I would like to organize them in a similar manner described above
for example let's say i have 1200 points
i want matrix to look like this
[first column] S.no 1 no of points 500
then 501st column S no 2 no of points 400
and finally 901 column S no 3 no of points 300
Would a strucutre or a class be better suited.
the class can have a method which retrieves the desired no of points for the particular S no
  6 comentarios
Adam Danz
Adam Danz el 21 de Sept. de 2021
Editada: Adam Danz el 21 de Sept. de 2021
Instead of concatenating the 2xN coordinates along the second dimension, if N is equal for all circles, then I would concatenate them along the 3rd dimension using cat(3,___). If N is not equal for all circles, I would store each set of coordinates in a 1xN or Nx1 cell array.
Note that your description differs from the contour output in that your data are coordinates whereas the contour output contains level and number-of-verticies which is does not intuitively provide coordinate information.
sparsh garg
sparsh garg el 21 de Sept. de 2021
yes i think that might work,i will try it .

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Contour 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