I would like to convert matlab.mat file to a .csv file. Here is the loading procedure:
>> FileData = load('matlab.mat')
FileData =
struct with fields:
MIMICtable: [278340×59 table]
Then I tried to save the CSV file but the following error occurs:
>> csvwrite('file.csv',MIMICtable)
Check for missing argument or incorrect argument data type in call to function 'real'.
Error in csvwrite (line 47)
throw(e)
I am not sure the meaning of the error message. Could someone help?
CodePudding user response:
Your data is a table
object. Use the function writetable
to write it to a CSV file. csvwrite
accepts only numeric arrays as input.
Yes, this is a weird error message. On the other hand, csvwrite
is no longer recommended, which means it has been superseded by a newer function, and is no longer maintained.