Problem with code running

1 view (last 30 days)
passioncoding
passioncoding on 15 Apr 2019
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

Answers (0)

Categories

Find more on Multidimensional Arrays in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!