I want to overwrite my old xls file with the new xls file each time i generate a new data
조회 수: 13 (최근 30일)
이전 댓글 표시
I am new to matlab and I am using "xlswrite" operation. At 1st, I am generating 150 data into a xls file. After the 1st testing, I am thinking to generate 2 data into the xls but only the 1st and 2nd data in the xls file being overwritten and data from 3rd until 150th of the 1st testing is still there. What can I do to make sure I only get the numbers of data that I want in the xls file?
My codes as below
clc
a=input('Enter Number of Cities need to travel: ');
b=2;
city= randi(100,[a,b])
xlswrite('Data.xls',city
댓글 수: 0
채택된 답변
LY Cao
2011년 11월 24일
clc
a = input('Enter Number of Cities need to travel: ');
b = 2;
t = xlsread('Data.xls');
if ~isempty(t)
xlswrite('Data.xls',zeros(size(t))*nan);
end
city = randi(100,[a,b]);
xlswrite('Data.xls',city);
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 MATLAB Report Generator에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!