With this code you get value on cell (A , fila):
ActivesheetRange = get(Activesheet,'Range',['A',num2str(fila)]);
To check if this cell is empty you can use:
isnan(ActivesheetRange.value)
Make a loop that looks for a empty cell along a row and you will get how many columns you have.