How do you write a .csv file into excel without carrying along the commas with it?
2 次查看(过去 30 天)
显示 更早的评论
Here is my code to read and write the .csv file:
%-----------------------------------------------------------------------------------------------------------------------------------------
fileID = fopen(ExPath1);
c = textscan(fileID, '%s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s');
fclose(fileID);
xlswrite('Book.xlsx', [c{:}])
%-------------------------------------------------------------------------------------------------------------------------------------------
The reason why I am reading in the data first is because I would like to alter the data and then save the newly altered data as an excel file.
0 个评论
回答(1 个)
Caroline
2013-8-5
I think you can use textscan to specify the delimeter. For example:
c = textscan(fileID, '%s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s', 'delimeter', ',');
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!