Write data to new excel file

1 回表示 (過去 30 日間)
mano49j
mano49j 2016 年 12 月 15 日
コメント済み: mano49j 2016 年 12 月 15 日
Suppose if I have an excel file saved like below: xlswrite('file1.xls',[1 2 3 4 5 6]);
The Excel file will contain data as [1 2 3 4 5 6] Later when I do: xlswrite('file1.xls',[9 8 10]);
The Excel file will contain data as [9 8 10 4 5 6] instead of just [9 8 10];
How to specify that clear previous content and write in fresh..?

回答 (1 件)

KSSV
KSSV 2016 年 12 月 15 日
You can check whether the file exists...and then delete the file and use xlswrite.
clc; clear all ;
xlswrite('file1.xls',[1 2 3 4 5 6]);
if exist('file1.xls','file')
delete('file1.xls')
disp('file deleted')
end
xlswrite('file1.xls',[9 8 10]);
  1 件のコメント
mano49j
mano49j 2016 年 12 月 15 日
It can be done that way. But, I am looking for something which can be specified as input parameter to xlswrite which does the same..

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

カテゴリ

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