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.
댓글 수: 0
채택된 답변
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!