MATLAB: Include data in excell

excel

Hi
I have 3 cell data from matlab that have to be include in excel.
Now the problem is that i want to include the 3 cell data at the first cell of the row that is not already written. This meaning if in excell there is
A1(cell) = 1
A2(cell) = 2
I want to write a script that understands that A1 and A2 cell are already with data and should add the new 3 cell data after the A2 cell (in excel).
I hope you understand what i am talking about. I was thinking of reading first the whole row in a Boolean way and see what are 0 and 1 but then I have a problem of how to tell matlab where he should start to put the data in?

Best Answer

Hi Alexandros,
what about the following:
% read the file
[~,~,data] = xlsread('yourfile.xls');
% add at the end your data
data{end+1,1} = 42.0;
% and write the result back to your file:
xlswrite('yourfile.xls', data);
If you need to add more then just one number use [] or indices or something similar ...
Titus