Talk:FAQ/@comment-140.112.229.142-20190219075528/@comment-3197849-20190224013259

If you are using MS Windows with Excel installed, then if your data is purely numeric, you can store it in a numeric array, and you can use xlswrite naming a .csv file, a .xls file, or a .xlsx file. Or you can use csvwrite or dlmwrite.

If you are using MS Windows with Excel installed, then if your data is not purely numeric, then put each element into its own cell array cell, and you can use xlswrite naming a .csv file, a .xls file, or a .xlsx file. You cannot use csvwrite or dlmwrite in this case.

If you are using MS Windows without Excel installed, or you are using Mac or Linux, then if your data is purely numeric, you can store it in a numeric array, and you can use xlswrite naming a .csv file, but not a .xls or .xlsx file. Or you can use csvwrite or dlmwrite.

If you are using MS Windows without Excel installed, or you are using Mac or Linux, then if your data is not purely numeric, then you cannot use xlswrite or csvwrite or dlmwrite.

If you are using R2013b or later, then no matter which operating system you are using, you can store your data into a table object and writetable to a .csv file, or a .xls file, or a .xlsx file. This applies even if your data is not all numeric. If you happen to be using MS Windows with Excel installed, then writetable will talk to Excel using ActiveX controls in order to write the data; if you are using MS Windows without Excel installed or you are using Mac or Linux, then writetable will use internal routines, and can write to .xls and .xlsx files. If your data is purely numeric, you can use array2table to convert to table object; if you have a cell array then you can use cell2table to convert to table object.

If .csv file is acceptable, then on all operating systems, you have the option of using fopen, fprintf, fclose to write data into a .csv file in whatever format you prefer.