get an Excel file write data, but 'save as ...' (not overwrite the parent file)

3 views (last 30 days)
M
M on 13 Nov 2014
Answered: Ken Atwell on 14 Nov 2014
Hi everyone,
I do have hard copy of a data set, and will do some more experiment. The guys before me used to record their data on paper. They made an excel file (call it FORM), but never used it to save data in a computer. I want to save my data (call it experiment conditions) and also input the previous data in a this FORM.
The question is, how I can use that FORM to save different data sets on that, but save as a different file (not overwriting the previous data). Is there any way to use that format but save the file with other name?
%example!
The Form is saved as FORM.xls, I need to save multiple data sat in different Forms. e.g. FORM1.xls (for data set 1), FORM2.xls (for data set 2) and so on... but not overwrite the previous form (FORM.xls). Now I duplicate FORM.xls as FORM1.xls and FORM2.xls separately (using windows copy/paste) and export data using MATLAB. But I am sure there should be a way to do this directly from MATLAB.
Thank you very much in advance!
M

Answers (1)

Ken Atwell
Ken Atwell on 14 Nov 2014
The first argument to xlswrite is the filename, so use that to create new files. Something like:
n = xlsread('FROM.xls');
n1 = doStuff(n);
xlswrite('FORM1.xls', n1);
n2 = doOtherStuff(n);
xlswrite('FORM2.xls', n2);

Community Treasure Hunt

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

Start Hunting!