Recreating a multiport switch with code
显示 更早的评论
I have 40 different streams of data (formatted time, value) numbered 1 through 40 and one control stream that selects which data stream to pass through (time, stream id). I'm trying to switch between different streams of data depending on what the control stream says can be passed through. For example, control stream (time, stream id)
0 1
1 3
2 3
3 1
4 1
5 5
6 4
7 9
8 2
9 1
10 1
So for time 0-.9 (assuming resolution is .1) the first data stream should be passed through (select time=0 to .9 from data stream and make it first portion in new stream) then for 1 to 2.9 pass through the data from stream 3 that has a time of 1 to 2.9 and attach it to the end of the new stream, etc. At the end you have one data stream that's made up of parts of the 40 different streams.
This is essentially what a multiport switch does, but I wanted to try and recreate the operation in code. Any help would be greatly appreciated.
Thanks in advance for your help!
采纳的回答
更多回答(1 个)
Walter Roberson
2013-10-15
[count, idx] = histc(currenttime, control_table(:,1));
datastream = control_table(idx, 2);
类别
在 帮助中心 和 File Exchange 中查找有关 Data Import and Management 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!