MATLAB Answers

0

How do you write a .csv file into excel without carrying along the commas with it?

Cordelle 님이 질문을 제출함. 5 Aug 2013
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

로그인 to comment.

답변 수: 1

Caroline 님의 답변 5 Aug 2013

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', ',');

  댓글 수: 1

is there a way to declare multiple delimiters like ',' and ':' at the same time

로그인 to comment.



Translated by