필터 지우기
필터 지우기

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

조회 수: 1 (최근 30일)
sparsh garg
sparsh garg 2021년 9월 21일
댓글: sparsh garg 2021년 9월 21일
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
Adam Danz
Adam Danz 2021년 9월 21일
편집: Adam Danz 2021년 9월 21일
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 2021년 9월 21일
yes i think that might work,i will try it .

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Contour Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by