Recreating a multiport switch with code
Mostrar comentarios más antiguos
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!
Respuesta aceptada
Más respuestas (1)
Walter Roberson
el 15 de Oct. de 2013
[count, idx] = histc(currenttime, control_table(:,1));
datastream = control_table(idx, 2);
Categorías
Más información sobre Data Import and Management en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!