两个事件之间的时间长度

8视图(30天)
玛丽亚
玛丽亚 2023年3月30日
评论道: 克里斯 2023年4月6日
我有一个表3列:传感器ID、启动时间、停止时间,像这样:
2》2023年3月20日18:01:24.318‘2023年3月20日18:14:29.431”
2》2023年3月20日20:01:17.651‘2023年3月20日20:13:36.931”
2》2023年3月21日06:23:12.515‘2023年3月21日06:37:34.666”
2》2023年3月21日08:25:49.680‘2023年3月21日08:34:08.341”
3 ' 2023年3月20日23:09:56.209‘2023年3月20日23:23:32.154”
3 ' 2023年3月21日01:17:08.676‘2023年3月21日01:31:28.003”
3 ' 2023年3月21日10:20:17.002‘2023年3月21日10:22:52.180”
3 ' 2023年3月21日12:21:13.756‘2023年3月21日12:37:30.450”
4 2023年3月20 16:50:51.910‘2023年3月20日16:53:08.560”
4“2023年3月21日01:11:16.404”“2023年3月21日01:19:06.159”
4“2023年3月21日03:07:32.598”“2023年3月21日03:22:05.176”
4“2023年3月21日13:31:47.726”“2023年3月21日13:43:56.867”
4“2023年3月21日15:30:50.827”“2023年3月21日15:43:57.428”
我想情节,y轴上的传感器数量,在x轴之间的长度或时间开始时间和停止时间。基本上,我需要像一个水平误差棒,“错误”的启动和停止时间之间的时间。
我可以创建这个“错误”和情节,但是我在想如果有一个更容易/ mote直接的方法。
这是一个情节我希望的例子:

接受的答案

克里斯
克里斯 2023年3月30日
编辑:克里斯 2023年3月30日
没有你的代码,很难说什么是“简单”。Errorbar plots are pretty simple.
您可以使用 补丁
%我的表是“t”变量“sid (double)”“starttime (datetime)”,,和"stoptime (datetime)"
nsens = 32;%或然而许多传感器
clr =线(nsens);
barhalfheight = 0.1;
x = [t。开始时间,t。stoptime, t。stoptime t.starttime);
y = t。sid + barhalfheight。* (1,1,1,1);
c = clr (t.sid:)
idx = 1:尺寸(x, 1)
补丁(x (idx:), y (idx:), c (idx,:))
结束
集(gca),“YTick”1:nsens)
集(gca),“YTickLabel”,“传感器”+ (1:nsens))
9日评论

登录置评。

更多的答案(0)

社区寻宝

找到宝藏在MATLAB中央,发现社区如何帮助你!

开始狩猎!