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

6 vues (au cours des 30 derniers jours)
Alexandra Topciov
Alexandra Topciov le 10 Sep 2015
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)

Réponse acceptée

Alexandra Topciov
Alexandra Topciov le 20 Oct 2015
Modifié(e) : Alexandra Topciov le 20 Oct 2015
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

Plus de réponses (0)

Catégories

En savoir plus sur Data Import from MATLAB dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by