I have a program that calculates out several values and I want to write them to an Excel data sheet. However, I do not want the data to be overwritten. This is to be a log, so every time the program runs it needs to write to the next blank row.
The solutions I have seen are all for a single program run, and if you run the program again it overwrites the data from the previous run. A program that starts writing at A1 or similar is not what I am looking for.
So I am looking for a solution that will look into the Excel file I am writing into and determine what column is the first that is blank, and then write to that row. I can figure out the remaining data handling myself (hopefully!).
Any ideas, thoughts, or solutions? Any help is greatly appreciated!
-Michael
example:
file directory
file = 'C:\Documents and Settings\desktop\rarb.xls'
% store data of file in variable a
a = xlsread(file);
% new data to write in file
t = ones(1,10)
% last row with data in the file
nRows = (size(a,1));
% plus 1 to write in the next line (if you have an header it should be + 2)
nRows = nRows +1;
% convert number to string
b = num2str(nRows)
% if you want to add data to the collum A you make concat strings
c = strcat('A', b)
% right to file the data t on the sheet Folha1 begining in the row c (e.g. A20)
xlswrite(file, t,'Folha1',c);