MAC: Write numberical dataset with string header row to .csv

2 次查看(过去 30 天)
I know this has topic has been broached in the PC world, so I apologize if this has been successfully addressed for MAC. I have seen a few convoluted options, though I have been unsuccessful in getting them functional for me.
I am attempting to write a dataset to a .csv file. This is a numeric matrix with a string header. I have made various attempts with csvwrite, dlmwrite, export, etc. I understand there are issues with MAC contacting Excel, but I wonder if there is a simple, elegant work around for this issue? Perhaps something I am missing?
Sorry, I know this is woe-fully rudimentary.

回答(1 个)

Walter Roberson
Walter Roberson 2016-6-11
fopen() the output file and fprintf() the header into it. After that you have two choices:
1) continue onwards by using fprintf() to write out the numeric part, and then fclose() the file; or
2) fclose the file, and then use dlmwrite() with the append option to write the numeric part.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by