필터 지우기
필터 지우기

What is the best way to store different variables into 1 variable?

조회 수: 1 (최근 30일)
Steve
Steve 2019년 10월 15일
댓글: Steve 2019년 10월 17일
I need to take a bunch of coordinate points that I have stored in a variable, and sort them in groups of the ten closest endpoint triplet groups to each other triplet. Then, I need to store them along with another group of coordinate points that correspond to the central points of each of these triplets. What's the best way to do this? The attached file contains all the (x,y) coordinates for the endpoint triplets (first 6 columns), and the central points (last two columns) Thanks in advance for your help!

답변 (1개)

John D'Errico
John D'Errico 2019년 10월 15일
편집: John D'Errico 2019년 10월 15일
Use a cell array. Or use a srruct. Either can store anything you put into it.
Here, a struct will allow you to store everything with a name attached to each field, so it will be arguably a better choice. And you can have arrays of structs.
  댓글 수: 5
Walter Roberson
Walter Roberson 2019년 10월 16일
You overwrite ascendIdx each iteration of the loop, so it is not clear why you would bother to do
ascendIdx(ascendIdx==pt) = []; %remove the pt point
It would make more sense if that was just after the sort()
Steve
Steve 2019년 10월 17일
Could you give me an example of how you would set up the proper code?

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

카테고리

Help CenterFile Exchange에서 Text Analytics Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by