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.

답변 (1개)

Caroline
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 CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by