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

조회 수: 1 (최근 30일)
Alexandra Topciov
Alexandra Topciov 2015년 9월 10일
편집: Alexandra Topciov 2015년 10월 20일
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에서 Spreadsheets에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by