Drop down in uitable to work like excel
I have an uitable and I want to have certain cells with a drop down. I know that this is done by using the functions categorical and table. The problem is that I need the table to accept empty values and show the empty values as a blank cell with the drop down functionality. If I add the empty option to a categorical this will show as <undefined>
Data = cell(21,2);
for i = 1:length(Data)
for j = 1:length(Data)
Data{i,j} = "";
end
end
fig = uifigure;
tab = uitable(fig);
opts = categorical({‘1′,’2’,”});
Data{2,1} = opts(3);
Column1 = Data(:,1);
Column2 = Data(:,2);
tab.Data = table(Column1,Column2);
By making the Columns editable and changing the <undefined> value it will show always one of the non-empty options entered in the categorical function and not allowing the cell to be empty (or <undefined>) anymore:
Is there a way to allow this types of cells to work like the drop downs works in Excel?
Thank you beforehand.I have an uitable and I want to have certain cells with a drop down. I know that this is done by using the functions categorical and table. The problem is that I need the table to accept empty values and show the empty values as a blank cell with the drop down functionality. If I add the empty option to a categorical this will show as <undefined>
Data = cell(21,2);
for i = 1:length(Data)
for j = 1:length(Data)
Data{i,j} = "";
end
end
fig = uifigure;
tab = uitable(fig);
opts = categorical({‘1′,’2’,”});
Data{2,1} = opts(3);
Column1 = Data(:,1);
Column2 = Data(:,2);
tab.Data = table(Column1,Column2);
By making the Columns editable and changing the <undefined> value it will show always one of the non-empty options entered in the categorical function and not allowing the cell to be empty (or <undefined>) anymore:
Is there a way to allow this types of cells to work like the drop downs works in Excel?
Thank you beforehand. I have an uitable and I want to have certain cells with a drop down. I know that this is done by using the functions categorical and table. The problem is that I need the table to accept empty values and show the empty values as a blank cell with the drop down functionality. If I add the empty option to a categorical this will show as <undefined>
Data = cell(21,2);
for i = 1:length(Data)
for j = 1:length(Data)
Data{i,j} = "";
end
end
fig = uifigure;
tab = uitable(fig);
opts = categorical({‘1′,’2’,”});
Data{2,1} = opts(3);
Column1 = Data(:,1);
Column2 = Data(:,2);
tab.Data = table(Column1,Column2);
By making the Columns editable and changing the <undefined> value it will show always one of the non-empty options entered in the categorical function and not allowing the cell to be empty (or <undefined>) anymore:
Is there a way to allow this types of cells to work like the drop downs works in Excel?
Thank you beforehand. dropdown, uitable, excel, empty MATLAB Answers — New Questions