I have a pandas dataframe that has 3 rows by 3 columns. The dataframe has the following form:
Input Dataframe:
A | B | C |
---|---|---|
A1 | B1 | C1 |
A2 | B2 | C2 |
A3 | B3 | C3 |
I want to generate a .mat file from that dataframe and that when I open it in matlab it will be of the 3x3 table type, the same as the dataframe. I have tried the following code:
savemat('matlab.txt', {'df_name': df.to_records(index=False)})
When I do this, it generates the .mat file for me but it does not create a table in matlab, instead it creates a 1x3 structure and then takes the information.
How can I create a matlab file that when opened in matlab is a 3x3 table type?