how to plot substracted data
Show older comments
if true
function test(data,t)
figure;
fprintf(1,'%s %d\n', t, length(data));
plot((data(2:end,2)-data(1:end-1,2))./1000000000,data(:,3),'r-');
hold on;
plot((data(2:end,2)-data(1:end-1,2))./1000000000,data(:,4),'g-');
plot((data(2:end,2)-data(1:end-1,2))./1000000000,data(:,5),'b-');
title(t);
dt = (data(2:end, 2)- data(1:end-1, 2))./1000000000;
figure;
hist (dt, [0:0.002:0.5]);
title(t);
end
hi all, i try to subtract the values as shown above so that i can get the time in seconds(the 2nd column in the data contains timestamps in nanoseconds) as shown below:
1 144274932861 -0.16280572 9.49301 -0.36391866
2 144279571533 0.10295067 9.557653 -0.46926352
3 144284942626 0.2908955 9.586384 -0.5650316
4 144289581298 0.2837129 9.657013 -0.51595044
5 144294952392 0.09816227 9.685743 -0.46088383
6 144299591064 -0.09696517 9.736021 -0.33638534
7 144304962158 -0.19871874 9.750386 -0.32680854
8 144309631347 -0.12090719 9.783905 -0.40940848
9 144314971923 0.075417355 9.828198 -0.47524905
10 144319610595 0.14963761 9.831789 -0.46447513 etc
so at the end of the day i want to get the timestamp(2nd column) in secs.
However, the error message that i get is: Matrix dimensions must agree.
Error in test (line 5) plot(data(2:end,2)-data(1:end,2),data(:,3),'r-');
any idea? thanks!
Accepted Answer
More Answers (0)
Categories
Find more on Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!