% Read in csv
clc
clear
A=csvread('t9_x.csv',1);
Head = { 'Time' 'PWMleft' 'PWMright' 'Battery' 'Motor_Rev_A' 'Motor_Rev_B' 'Motor_Rev_C' 'theta' 'psi' 'thetadot' 'psidot' 'I2C'};
plotarray=[0 1 0 0 0 1 0 0 1 0 0 0];
iPlots = sum(plotarray);
i_sub = 0;
close all;
for R = 1:12
eval([Head{R} '=A(:,R);']);
end
theta =theta * 2^-10;
psi =psi * 2^-10;
thetadot =thetadot * 2^-10;
psidot =psidot * 2^-10;
%plot(Time,theta,Time,psi,Time,thetadot,Time,psidot)
%legend('theta','psi','thetadot','psidot')
a=300;
b=6000;
plot(Time(a:b),theta(a:b)*3,'o-',Time(a:b),Motor_Rev_B(a:b),'o-')
legend('theta','Motor_Rev_B')
%
% Head{2}='PWM_LR';
% for R = 1:12
% if plotarray(R)
% i_sub = i_sub + 1;
% subplot(iPlots,1,i_sub);
% eval(['plot(Time,' Head{R} ');'])
% title(strrep(Head{R},'_',' '));
% end
%
% end