table = readtable('laser_data.csv'); array = table2array(table); for i = 1:length(array) %LEFT hold on for k = 2:2:30 x = -0.018+array(i,k); y = 0.0899+array(i,k+1); xlabel('Distancia en el eje X') ylabel('Distancia en el eje Y') title('Obstáculos') h = scatter(x, y, 10, 'r'); drawnow limitrate %pause(0.00001) end drawnow %FRONT for k = 32:2:60 x = 0.05620-array(i,k+1); y = array(i,k); xlabel('Distancia en el eje X') ylabel('Distancia en el eje Y') title('Obstáculos') h = scatter(x, y, 10, 'r'); drawnow limitrate %pause(0.00001) end drawnow %RIGHT for k = 62:2:90 x = 0.018-array(i,k); y = -0.0899-array(i,k+1); xlabel('Distancia en el eje X') ylabel('Distancia en el eje Y') title('Obstáculos') h = scatter(x, y, 10, 'r'); drawnow limitrate % pause(0.00001) end drawnow end
But it takes like 30 minutes to plot, and using this one: just takes 30 secs but i dont want lines, i want points.
table = readtable('laser_data.csv'); array = table2array(table); h = animatedline('Marker','none'); for i = 1:length(array) %LEFT for k = 2:2:30 x = -0.018+array(i,k); y = 0.0899+array(i,k+1); xlabel('Distancia en el eje X') ylabel('Distancia en el eje Y') title('Obstáculos') addpoints(h,x,y) drawnow limitrate %pause(0.00001) end %FRONT for k = 32:2:60 x = 0.05620-array(i,k+1); y = array(i,k); xlabel('Distancia en el eje X') ylabel('Distancia en el eje Y') title('Obstáculos') addpoints(h,x,y) drawnow limitrate %pause(0.00001) end %RIGHT for k = 62:2:90 x = 0.018-array(i,k); y = -0.0899-array(i,k+1); xlabel('Distancia en el eje X') ylabel('Distancia en el eje Y') title('Obstáculos') addpoints(h,x,y) drawnow limitrate % pause(0.00001) end end
h = animatedline('Marker','none');
There's your problem...
array=readmatrix('laser_data.csv'); % no point in a table to just convert to array... hAL=animatedline('Marker','.','MarkerSize',3,'LineStyle','none'); % set a point marker, no line... xlabel('Distancia en el eje X') % don't update static info every pass through loop ylabel('Distancia en el eje Y') title('Obstáculos') for i=1:size(array,1) % length() is risky %LEFT for k = 2:2:30 x = -0.018+array(i,k); y = 0.0899+array(i,k+1); addpoints(hAL,x,y) drawnow limitrate %pause(0.00001) end ...
Make same changes in rest. It would be better to factor code so don't have repeated identical loops with just constants changing between, but that's another exercise...
Matlabsolutions.com provides guaranteed satisfaction with a
commitment to complete the work within time. Combined with our meticulous work ethics and extensive domain
experience, We are the ideal partner for all your homework/assignment needs. We pledge to provide 24*7 support
to dissolve all your academic doubts. We are composed of 300+ esteemed Matlab and other experts who have been
empanelled after extensive research and quality check.
Matlabsolutions.com provides undivided attention to each Matlab
assignment order with a methodical approach to solution. Our network span is not restricted to US, UK and Australia rather extends to countries like Singapore, Canada and UAE. Our Matlab assignment help services
include Image Processing Assignments, Electrical Engineering Assignments, Matlab homework help, Matlab Research Paper help, Matlab Simulink help. Get your work
done at the best price in industry.