csvfile-conversionasammdf

Looking for a way to write a csv file to mdf4 format?


looking for a way to write/convert .csv data to mf4 format programatically.

I have done it singularly using IPEmotion. I have checked out https://www.turbolab.de/mdf_libf.htm and opened up their code listed on that site. If anyone has even used this before I would be grateful for advice. I primarily use LabVIEW, but am open to python/c++/C# solutions.


Solution

  • You could load the csv using pandas and append it to a MDF object using this lib https://asammdf.readthedocs.io/en/latest/api.html#mdf4 (see the append method)

    from asammdf import MDF
    import pandas as pd
    
    df = pd.read_csv('input.csv')
    
    mdf = MDF()
    
    mdf.append(df)
    
    mdf.save('output.mf4')