Problem with code running

1 次查看(过去 30 天)
passioncoding
passioncoding 2019-4-15
function prm = path_planner
% Import Obstacle Locations
filename ='Simple2Obst.txt';
delimiterIn = ' ';
headerlinesIn = 0;
rawdata = importdata(filename,delimiterIn,headerlinesIn);
object_coord = rawdata(1:2:1000);
% Draw Course
map = figure;
course_outx=[-2,-4,-6,-6, 6,6,4,2];
course_outy=[ 0, 0, 0,12,12,0,0,0];
hold on;
plot(course_outx,course_outy,'k','LineWidth',5);
axis([-7,7,-6,13]);
axis equal
set(gca,'XTick',-13:1:13)
set(gca,'YTick',-6:1:13)
grid ON
obst.ball = {};
% Tile the obstacles with balls
count = 1;
for i=1:2:500
if (object_coord(i,1)<999)
onew.p = [object_coord(i,1);object_coord(i+1,1)]; % line 29
onew.r = 1/3;
onew.handle = [];
obst.ball{end+1} = onew;
circle(onew.p(1,1),onew.p(2,1),onew.r,'b');
end
end
I am trying to run this code but as it reaches to line 29 it says "Index increses matrix dimension.
I donot know how to solve this problem.
Index exceeds matrix dimensions.
Error in RRTpathplan (line 29)
onew.p = [object_coord(i,1);object_coord(i+1,1)];
It says this

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Multidimensional Arrays 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by