MATLAB: Uitable operation

genetic algorithmMATLABmatlab coderuitable

I want to perform the uitable operation as below:
1. Row first has 15 empty cells, row second has 15 empty cells and row three has 15 empty cells too.
2. In row 1st, I put a number in cell 1 and cell 6. In row 2nd, I put a number in cell 7. In row 3 still empty.
3. In row 1st, 2nd and 3rd, I need to put number 0 automaticly accept the filled cells before.
How this operation will code? I want to know the steps because really do not know how. Please help me.

Best Answer

data = cell(3,15);
data{1,1} = rand; data{1,6} = rand;
data{2,7} = rand;
data(cellfun(@isempty,data)) = 0;
uitable(..., 'Data', 'data');