I want to avoid writing over existing cells when writing data to an Excel spreadsheet through MATLAB.
I need to save a 1X2 array of experiment results into Excel using MATLAB. Each time I run the script, MATLAB overwrites the results to cell A1 in Excel. I need to stop this from happening, and have MATLAB find the next free row in Excel and write to it.
My approach is to first read and store the spreadsheet as an array. Calculate the size of array, figure out the next free cell and write to it to avoid overwrites. However I can't seem to find how to write to a specific cell from MATLAB.
Any suggestions on either how to write to a specific cell or avoid overwrites altogether using simple code?
Sample Code:
num = xlsread('var_data.xlsx');
row_no = size(num,1);
xlswrite('var_data.xlsx',var_dat,'**ideally row_no**')