Main Content

readtimetable

Read timetable from event stream

Since R2022b

    This function requires Streaming Data Framework for MATLAB® Production Server™.

    Description

    tt = readtimetable(stream) creates a timetable from an event stream.

    readtimetable converts events from an event stream into rows of a timetable, where:

    • The names in the event body become the timetable column names

    • The value associated with each name becomes the column value in the event row.

    • The event timestamp becomes the row timestamp.

    example

    Examples

    collapse all

    Assume that you have a Kafka® server running at the network address kafka.host.com:9092 that has a topic CoolingFan.

    Create a KafkaStream object for reading from and writing to the CoolingFan topic.

    ks = kafkaStream("kafka.host.com",9092,"CoolingFan");

    Read events from the CoolingFan topic into a timetable.

    tt = readtimetable(ks)
    tt =
    
      50×11 timetable
    
             timestamp          vMotor    wMotor    Tmass     
        ____________________    ______    ______    ______    
    
        31-Oct-2020 00:00:00    1.0909         0        25           
        31-Oct-2020 00:00:00    1.1506     100.5     25.17           
        31-Oct-2020 00:00:00    1.1739     190.9    25.223             
        31-Oct-2020 00:00:00     1.162    267.96    25.192           
        31-Oct-2020 00:00:00    1.1454    330.61     25.15            
    
                 :                :         :         :         
    
        31-Oct-2020 00:00:19    1.0269    239.35    25.785        
        31-Oct-2020 00:00:19    1.0332    240.45    25.803            
        31-Oct-2020 00:00:19    1.0267    263.98    25.784             
        31-Oct-2020 00:00:19    1.0262    243.69    25.783            
        31-Oct-2020 00:00:19    1.0262    257.21    25.783            
    
    	Display all 50 rows.

    Input Arguments

    collapse all

    Object connected to an event stream, specified as a KafkaStream, InMemoryStream, or TestStream object.

    Version History

    Introduced in R2022b