How can i always check if a cell is written in excel?

4 次查看(过去 30 天)
I want to know if there is a way (a loop or something) to check if it's written every cell in Excel (begging with A1), everytime I press a button in GUI and if it's not written, to write there. ( I already have a code to write in the next row but if i write in A1, A2, A3 and then erase what is written in A2, the next time I press the button it writes in A4, I want it to write in the empty cell A2)

采纳的回答

Alexandra Topciov
Alexandra Topciov 2015-10-20
编辑:Alexandra Topciov 2015-10-20
I have solved the problem. I'm going to leave my example if anyone needs it:D
read Excel sheet
[num,txt,raw]=xlsread('X.xls','X1');
copy data
rowData={Z, X1, Y1, X2, X3, Y0, UP}; (the data i want to write)
make it go to next row
row =(size(raw,1))+1;
search for empty row between data in and if it exists write in it then stop
[nm, nn] = size(raw);
for im=1:nm
NaNIndex = find(isnan(raw{im}));
if NaNIndex==1
xlswrite(...);
break
end
end
if there isn't an empty row write after the last row
if isempty(NaNIndex)
xlswrite(...);
end

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Import from MATLAB 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by