Guest User

Untitled

a guest
May 9th, 2012
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. Adding letters to 3D plot data points in Matlab
  2. clear all
  3. clc
  4.  
  5. csv=csvread('pilot6/maindroite.csv',1,0); %read the values from a csv
  6. both = csv(:,2:19);
  7.  
  8. ax=axes;
  9. set(ax,'NextPlot','replacechildren');
  10.  
  11. Dt=0.1; %sampling period in secs
  12.  
  13. k=1;
  14. hp1=plot3(both(k,1),both(k,2),both(k,3),'ok'); %get handle to dot object
  15. hold on;
  16. hp2=plot3(both(k,4),both(k,5),both(k,6),'og');
  17. hp3=plot3(both(k,7),both(k,8),both(k,9),'ob');
  18. hp4=plot3(both(k,10),both(k,11),both(k,12),'oc');
  19. hp5=plot3(both(k,13),both(k,14),both(k,15),'om');
  20. hp6=plot3(both(k,16),both(k,17),both(k,18),'or');
  21. hold off;
  22.  
  23. t1=timer('TimerFcn','k=doPlot(hp1,hp2,hp3,hp4,hp5,hp6,both,t1,k)','Period', Dt,'ExecutionMode','fixedRate');
  24. start(t1);
  25.  
  26. function k=doPlot(hp1,hp2,hp3,hp4,hp5,hp6,pos,t1,k)
  27.  
  28. k=k+1;
  29. if k<5000%length(pos)
  30. set(hp1,'XData',pos(k,1),'YData',pos(k,2),'ZData',pos(k,3));
  31. axis([0 255 0 255 0 255]);
  32. set(hp2,'XData',pos(k,4),'YData',pos(k,5),'ZData',pos(k,6));
  33. set(hp3,'XData',pos(k,7),'YData',pos(k,8),'ZData',pos(k,9));
  34. set(hp4,'XData',pos(k,10),'YData',pos(k,11),'ZData',pos(k,12));
  35. set(hp5,'XData',pos(k,13),'YData',pos(k,14),'ZData',pos(k,15));
  36. set(hp6,'XData',pos(k,16),'YData',pos(k,17),'ZData',pos(k,18));
  37.  
  38. else
  39. k=1;
  40. set(hp,'XData',pos(k,1),'YData',pos(k,2),'ZData',pos(k,3));
  41. axis([0 255 0 255 0 255]);
  42. end
Advertisement
Add Comment
Please, Sign In to add comment