How to store the different sizes of vectors ?

2 次查看(过去 30 天)
Hello,
I'm working on the following problem. It consists of hexagons with base stations(center red star) and mobile (blue dots).I want to store the coordinates of the mobile users in each hexagon. I'm trying to use the Inpolygon funtion to check whether the points are in the required hexagon or not.I write the code like this:
for i=1:Hexagons_total
IN = inpolygon(user_x,user_y,Hex_cord(i,1:7),Hex_cord(i,8:14));
m_c_x=user_x(IN);
m_c_y=user_y(IN);
m_c=[m_c_x;m_c_y];
end
how to store the coordinates of each hexagon.Suppose if i want to assign the matrix,the size varies from one hexagon to another(because the users are random in each hexagon). Can you guys help me how to store them?Because later I need to add some more mobile users to some hexagons.

采纳的回答

Nick Hobbs
Nick Hobbs 2015-10-29
I understand you want to store vectors of different sizes. One option for this is to use a cell array. Please refer to the following link for more information on cell arrays.

更多回答(0 个)

标签

Community Treasure Hunt

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

Start Hunting!

Translated by