MATLAB: How to write (1X279) cell array in csv? If i write like csvwrite(‘​filename.c​sv’,M) I got each letter of cell array writing in each cell in the csv(spread sheet).

csvwrite

ex: 'engine' is one of the cell array. It will be writing as 'e' in one cell ,'n' in one cell, 'g' in one cell like that it is getting continued in the csv(spread sheet). How to write 'engine' in single cell in the csv(spread sheet)?

Best Answer

Loop though the rows using strjoin() on the cells of the row with ',' (comma) as the join character, producing one vector of characters per row. Use dlmwrite instead of csvwrite and specify the delimiter character as '' (that is, the empty string)
Or... Use cell2table() and writetable()
You will not be able to do this with csvwrite itself.
Related Question