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

2 views (last 30 days)
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!

Answers (1)

John D'Errico
John D'Errico on 15 Oct 2019
Edited: John D'Errico on 15 Oct 2019
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.
Steve on 17 Oct 2019
Could you give me an example of how you would set up the proper code?

Sign in to comment.


Find more on Multidimensional Arrays in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!