Advertisement
Guest User

Untitled

a guest
Nov 27th, 2014
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 1.81 KB | None | 0 0
  1. %plotcsv({'walk_28_leander.csv', 'walk_29_leander.csv', 'walk_30_leander.csv', 'walk_31_leander.csv', 'walk_32_leander.csv', 'walk_33_leander.csv', 'walk_34_leander.csv', 'walk_35_leander.csv'})
  2. %plotcsv({'walk_46_wannes.csv', 'walk_47_wannes.csv', 'walk_48_wannes.csv', 'walk_49_wannes.csv', 'walk_50_wannes.csv', 'walk_52_wannes.csv', 'walk_53_wannes.csv', 'walk_54_wannes.csv', 'walk_55_wannes.csv', 'walk_56_wannes.csv', 'walk_57_wannes.csv', 'walk_58_wannes.csv'})
  3.  
  4. function plotcsv( path )
  5.  
  6. Mc = cell(length(path),1);
  7. for i=1:length(path)
  8.     Mc{i} = csvread(path{i},1,0);
  9. end    
  10.  
  11. M=[];
  12. for i=1:length(path)
  13.     M = [M;Mc{i}];
  14. end    
  15.  
  16. t = 0:(length(M(:,1))-1);
  17.  
  18. figure % create new figure
  19. subplot(2,1,1) % first subplot
  20. hold all
  21. plot(t(:),M(:,2),'r.-')
  22. plot(t(:),M(:,3),'g.-')
  23. plot(t(:),M(:,4),'b.-')
  24. xlabel('Tijd')
  25. legend('x','y','z')
  26.  
  27. M2 = [];
  28. opeenvolgend = 0;
  29. eersteIndex = -1;
  30. laatsteIndex = -1;
  31. indexen = []
  32. for i=1:50:(size(M,1)-50)
  33.     opeenvolgend = opeenvolgend+1
  34.     if sum((M(i:(i+49),2).*M(i:(i+49),2)) > 50) | sum((M(i:(i+49),3).*M(i:(i+49),3)) > 50) | sum((M(i:(i+49),4).*M(i:(i+49),4)) > 50)
  35.         if eersteIndex == -1
  36.             eersteIndex = i;
  37.         end
  38.         laatsteIndex = i+49;
  39.         M2 = [M2;M(i:(i+49),:)];
  40.     else
  41.         if eersteIndex ~= -1 && laatsteIndex - eersteIndex > 149
  42.             indexen=[indexen;eersteIndex laatsteIndex];
  43.         end
  44.         opeenvolgend = 0;
  45.         eersteIndex = -1;
  46.         laatsteIndex = -1;
  47.         M2 = [];
  48.     end
  49.    
  50.     if opeenvolgend == 10
  51.         eI = eersteIndex;
  52.         lI = laatsteIndex;
  53.         MT = M2;
  54.     end
  55.    
  56. end
  57.  
  58. t = eI:lI;
  59. subplot(2,1,2) % first subplot
  60. hold all
  61. plot(t(:),MT(:,2),'r.-')
  62. plot(t(:),MT(:,3),'g.-')
  63. plot(t(:),MT(:,4),'b.-')
  64. xlabel('Tijd')
  65. legend('x','y','z')
  66.  
  67. indexen
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement