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

2 ビュー (過去 30 日間)
Cordelle
Cordelle 2013 年 8 月 5 日
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', ',');
  1 件のコメント
Cordelle
Cordelle 2013 年 8 月 5 日
is there a way to declare multiple delimiters like ',' and ':' at the same time

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by