Closed Ernest124869 closed 3 years ago
This is my code
database_files = "/sf_7045/mf4/" (This is where I stored all of the MF4 files csv_folder = "/sf_7045/mf4/csv/" (This is where I would like all my results store
mdf_ = MDF(r'testing1.mf4)
database = {
"CAN": ["file1.dbc", "file2.arxml"],
"LIN": ["file3.dbc"],
}
extracted = mdf.extract_bus_logging(database_files=database_files)
extracted.save("./sf_7045/mf4/csv/sorted.csv")
Hi @Ernest124869
The MDF class only accepts a single file as argument. If you want to export to CSV file, then you could use the export() method. Most of the information are in the documentation: https://asammdf.readthedocs.io/en/master/index.html
Hi @Ernest124869
The MDF class only accepts a single file as argument. If you want to export to CSV file, then you could use the export() method. Most of the information are in the documentation: https://asammdf.readthedocs.io/en/master/index.html
Hi @JulienGrv
Thanks for your reply!!! Let me think of a way to let the function process all of the files.
Hi @JulienGrv
I tried to modify a bit of the code, and currently I am trying to solve one file only.
import os import asammdf import pandas as pd import numpy as np from asammdf import MDF, SUPPORTED_VERSIONS, signal
mdf = asammdf.MDF(r'bus_logging.mf4)
database = {
"CAN" :["file1.dbc", "file2.arxml"], "LIN" :["file3.dbc"],
}
extracted = mdf.extract_bus_logging(database_files=database)
mdf.export(fmt='csv', filename='sorted.csv',overwrite=True)
Problem: file1.dbc , file2.arxml and file3.dbc are not define
Hi @Ernest124869 ,
It's not easy for me to visualize what you're trying to do here. Do you actually need to extract bus logging? Did you try to just read your MDF file and export it to csv?
Hi everyone,
I am trying to convert some mf4 files to csv files from one folder to another folder.
So I have been looking at the API :
extract_bus_logging(database_files, version=None, ignore_invalid_signals=False, consolidated_j1939=True,ignore_value2text_conversion=True)
where the example code said:
"extrac CAN and LIN bus logging"
mdf = asammdf.MDF(r'bus_logging.mf4')
databases = {
"CAN": ["file1.dbc", "file2.arxml"],
"LIN": ["file3.dbc"],
}
extracted = mdf.extract_bus_logging(database_files=database_files)
However, I am not very sure how it works to be honest. Can somebody kindly explain how the above example and code works???
for example, what should I define for asammdf?, for (r'bus_logging.mf4') is it a folder path link? , for "file1.dbc" what should I put in here?, for database_file=database_files, what do they actually mean?
Hence, I can process more than one mf4 file at a time?
Thank you so much for helping!!